Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: fixed-rate: Add hw based registration APIs

Add registration APIs in the clk fixed-rate code to return struct
clk_hw pointers instead of struct clk pointers. This way we hide
the struct clk pointer from providers unless they need to use
consumer facing APIs.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>

+43 -8
+36 -8
drivers/clk/clk-fixed-rate.c
··· 45 45 EXPORT_SYMBOL_GPL(clk_fixed_rate_ops); 46 46 47 47 /** 48 - * clk_register_fixed_rate_with_accuracy - register fixed-rate clock with the 49 - * clock framework 48 + * clk_hw_register_fixed_rate_with_accuracy - register fixed-rate clock with 49 + * the clock framework 50 50 * @dev: device that is registering this clock 51 51 * @name: name of this clock 52 52 * @parent_name: name of clock's parent ··· 54 54 * @fixed_rate: non-adjustable clock rate 55 55 * @fixed_accuracy: non-adjustable clock rate 56 56 */ 57 - struct clk *clk_register_fixed_rate_with_accuracy(struct device *dev, 57 + struct clk_hw *clk_hw_register_fixed_rate_with_accuracy(struct device *dev, 58 58 const char *name, const char *parent_name, unsigned long flags, 59 59 unsigned long fixed_rate, unsigned long fixed_accuracy) 60 60 { 61 61 struct clk_fixed_rate *fixed; 62 - struct clk *clk; 62 + struct clk_hw *hw; 63 63 struct clk_init_data init; 64 + int ret; 64 65 65 66 /* allocate fixed-rate clock */ 66 67 fixed = kzalloc(sizeof(*fixed), GFP_KERNEL); ··· 80 79 fixed->hw.init = &init; 81 80 82 81 /* register the clock */ 83 - clk = clk_register(dev, &fixed->hw); 84 - if (IS_ERR(clk)) 82 + hw = &fixed->hw; 83 + ret = clk_hw_register(dev, hw); 84 + if (ret) { 85 85 kfree(fixed); 86 + hw = ERR_PTR(ret); 87 + } 86 88 87 - return clk; 89 + return hw; 90 + } 91 + EXPORT_SYMBOL_GPL(clk_hw_register_fixed_rate_with_accuracy); 92 + 93 + struct clk *clk_register_fixed_rate_with_accuracy(struct device *dev, 94 + const char *name, const char *parent_name, unsigned long flags, 95 + unsigned long fixed_rate, unsigned long fixed_accuracy) 96 + { 97 + struct clk_hw *hw; 98 + 99 + hw = clk_hw_register_fixed_rate_with_accuracy(dev, name, parent_name, 100 + flags, fixed_rate, fixed_accuracy); 101 + if (IS_ERR(hw)) 102 + return ERR_CAST(hw); 103 + return hw->clk; 88 104 } 89 105 EXPORT_SYMBOL_GPL(clk_register_fixed_rate_with_accuracy); 90 106 91 107 /** 92 - * clk_register_fixed_rate - register fixed-rate clock with the clock framework 108 + * clk_hw_register_fixed_rate - register fixed-rate clock with the clock 109 + * framework 93 110 * @dev: device that is registering this clock 94 111 * @name: name of this clock 95 112 * @parent_name: name of clock's parent 96 113 * @flags: framework-specific flags 97 114 * @fixed_rate: non-adjustable clock rate 98 115 */ 116 + struct clk_hw *clk_hw_register_fixed_rate(struct device *dev, const char *name, 117 + const char *parent_name, unsigned long flags, 118 + unsigned long fixed_rate) 119 + { 120 + return clk_hw_register_fixed_rate_with_accuracy(dev, name, parent_name, 121 + flags, fixed_rate, 0); 122 + } 123 + EXPORT_SYMBOL_GPL(clk_hw_register_fixed_rate); 124 + 99 125 struct clk *clk_register_fixed_rate(struct device *dev, const char *name, 100 126 const char *parent_name, unsigned long flags, 101 127 unsigned long fixed_rate)
+7
include/linux/clk-provider.h
··· 282 282 struct clk *clk_register_fixed_rate(struct device *dev, const char *name, 283 283 const char *parent_name, unsigned long flags, 284 284 unsigned long fixed_rate); 285 + struct clk_hw *clk_hw_register_fixed_rate(struct device *dev, const char *name, 286 + const char *parent_name, unsigned long flags, 287 + unsigned long fixed_rate); 285 288 struct clk *clk_register_fixed_rate_with_accuracy(struct device *dev, 286 289 const char *name, const char *parent_name, unsigned long flags, 287 290 unsigned long fixed_rate, unsigned long fixed_accuracy); 288 291 void clk_unregister_fixed_rate(struct clk *clk); 292 + struct clk_hw *clk_hw_register_fixed_rate_with_accuracy(struct device *dev, 293 + const char *name, const char *parent_name, unsigned long flags, 294 + unsigned long fixed_rate, unsigned long fixed_accuracy); 295 + 289 296 void of_fixed_clk_setup(struct device_node *np); 290 297 291 298 /**