Merge tag 'ntb-4.8' of git://github.com/jonmason/ntb
[deliverable/linux.git] / drivers / clk / clk-fixed-rate.c
index cd9dc925b3f85901822cdaf1c015eda743ffc040..2edb39342a02a8d6397c9f9cef9ccdcd95f6e656 100644 (file)
@@ -45,8 +45,8 @@ const struct clk_ops clk_fixed_rate_ops = {
 EXPORT_SYMBOL_GPL(clk_fixed_rate_ops);
 
 /**
- * clk_register_fixed_rate_with_accuracy - register fixed-rate clock with the
- *                                        clock framework
+ * clk_hw_register_fixed_rate_with_accuracy - register fixed-rate clock with
+ * the clock framework
  * @dev: device that is registering this clock
  * @name: name of this clock
  * @parent_name: name of clock's parent
@@ -54,13 +54,14 @@ EXPORT_SYMBOL_GPL(clk_fixed_rate_ops);
  * @fixed_rate: non-adjustable clock rate
  * @fixed_accuracy: non-adjustable clock rate
  */
-struct clk *clk_register_fixed_rate_with_accuracy(struct device *dev,
+struct clk_hw *clk_hw_register_fixed_rate_with_accuracy(struct device *dev,
                const char *name, const char *parent_name, unsigned long flags,
                unsigned long fixed_rate, unsigned long fixed_accuracy)
 {
        struct clk_fixed_rate *fixed;
-       struct clk *clk;
+       struct clk_hw *hw;
        struct clk_init_data init;
+       int ret;
 
        /* allocate fixed-rate clock */
        fixed = kzalloc(sizeof(*fixed), GFP_KERNEL);
@@ -79,22 +80,49 @@ struct clk *clk_register_fixed_rate_with_accuracy(struct device *dev,
        fixed->hw.init = &init;
 
        /* register the clock */
-       clk = clk_register(dev, &fixed->hw);
-       if (IS_ERR(clk))
+       hw = &fixed->hw;
+       ret = clk_hw_register(dev, hw);
+       if (ret) {
                kfree(fixed);
+               hw = ERR_PTR(ret);
+       }
+
+       return hw;
+}
+EXPORT_SYMBOL_GPL(clk_hw_register_fixed_rate_with_accuracy);
+
+struct clk *clk_register_fixed_rate_with_accuracy(struct device *dev,
+               const char *name, const char *parent_name, unsigned long flags,
+               unsigned long fixed_rate, unsigned long fixed_accuracy)
+{
+       struct clk_hw *hw;
 
-       return clk;
+       hw = clk_hw_register_fixed_rate_with_accuracy(dev, name, parent_name,
+                       flags, fixed_rate, fixed_accuracy);
+       if (IS_ERR(hw))
+               return ERR_CAST(hw);
+       return hw->clk;
 }
 EXPORT_SYMBOL_GPL(clk_register_fixed_rate_with_accuracy);
 
 /**
- * clk_register_fixed_rate - register fixed-rate clock with the clock framework
+ * clk_hw_register_fixed_rate - register fixed-rate clock with the clock
+ * framework
  * @dev: device that is registering this clock
  * @name: name of this clock
  * @parent_name: name of clock's parent
  * @flags: framework-specific flags
  * @fixed_rate: non-adjustable clock rate
  */
+struct clk_hw *clk_hw_register_fixed_rate(struct device *dev, const char *name,
+               const char *parent_name, unsigned long flags,
+               unsigned long fixed_rate)
+{
+       return clk_hw_register_fixed_rate_with_accuracy(dev, name, parent_name,
+                                                    flags, fixed_rate, 0);
+}
+EXPORT_SYMBOL_GPL(clk_hw_register_fixed_rate);
+
 struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
                const char *parent_name, unsigned long flags,
                unsigned long fixed_rate)
@@ -117,6 +145,17 @@ void clk_unregister_fixed_rate(struct clk *clk)
 }
 EXPORT_SYMBOL_GPL(clk_unregister_fixed_rate);
 
+void clk_hw_unregister_fixed_rate(struct clk_hw *hw)
+{
+       struct clk_fixed_rate *fixed;
+
+       fixed = to_clk_fixed_rate(hw);
+
+       clk_hw_unregister(hw);
+       kfree(fixed);
+}
+EXPORT_SYMBOL_GPL(clk_hw_unregister_fixed_rate);
+
 #ifdef CONFIG_OF
 /**
  * of_fixed_clk_setup() - Setup function for simple fixed rate clock
This page took 0.027554 seconds and 5 git commands to generate.