diff options
author | Stephen Boyd <sboyd@codeaurora.org> | 2016-02-07 03:11:06 -0500 |
---|---|---|
committer | Stephen Boyd <sboyd@codeaurora.org> | 2016-04-19 19:56:28 -0400 |
commit | 0759ac8a73dc2c8cc8ac697fbe5dbd8d67348d37 (patch) | |
tree | 10ffa8cd45a3d40af0b1dea5e1257930615d59c9 /drivers/clk | |
parent | 264b31719735eb1fcbed47cecdb20f517e804856 (diff) |
clk: fixed-factor: Add hw based registration APIs
Add registration APIs in the clk fixed-factor 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>
Diffstat (limited to 'drivers/clk')
-rw-r--r-- | drivers/clk/clk-fixed-factor.c | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c index 053448e2453d..75cd6c792cb8 100644 --- a/drivers/clk/clk-fixed-factor.c +++ b/drivers/clk/clk-fixed-factor.c | |||
@@ -68,13 +68,14 @@ const struct clk_ops clk_fixed_factor_ops = { | |||
68 | }; | 68 | }; |
69 | EXPORT_SYMBOL_GPL(clk_fixed_factor_ops); | 69 | EXPORT_SYMBOL_GPL(clk_fixed_factor_ops); |
70 | 70 | ||
71 | struct clk *clk_register_fixed_factor(struct device *dev, const char *name, | 71 | struct clk_hw *clk_hw_register_fixed_factor(struct device *dev, |
72 | const char *parent_name, unsigned long flags, | 72 | const char *name, const char *parent_name, unsigned long flags, |
73 | unsigned int mult, unsigned int div) | 73 | unsigned int mult, unsigned int div) |
74 | { | 74 | { |
75 | struct clk_fixed_factor *fix; | 75 | struct clk_fixed_factor *fix; |
76 | struct clk_init_data init; | 76 | struct clk_init_data init; |
77 | struct clk *clk; | 77 | struct clk_hw *hw; |
78 | int ret; | ||
78 | 79 | ||
79 | fix = kmalloc(sizeof(*fix), GFP_KERNEL); | 80 | fix = kmalloc(sizeof(*fix), GFP_KERNEL); |
80 | if (!fix) | 81 | if (!fix) |
@@ -91,12 +92,28 @@ struct clk *clk_register_fixed_factor(struct device *dev, const char *name, | |||
91 | init.parent_names = &parent_name; | 92 | init.parent_names = &parent_name; |
92 | init.num_parents = 1; | 93 | init.num_parents = 1; |
93 | 94 | ||
94 | clk = clk_register(dev, &fix->hw); | 95 | hw = &fix->hw; |
95 | 96 | ret = clk_hw_register(dev, hw); | |
96 | if (IS_ERR(clk)) | 97 | if (ret) { |
97 | kfree(fix); | 98 | kfree(fix); |
99 | hw = ERR_PTR(ret); | ||
100 | } | ||
101 | |||
102 | return hw; | ||
103 | } | ||
104 | EXPORT_SYMBOL_GPL(clk_hw_register_fixed_factor); | ||
105 | |||
106 | struct clk *clk_register_fixed_factor(struct device *dev, const char *name, | ||
107 | const char *parent_name, unsigned long flags, | ||
108 | unsigned int mult, unsigned int div) | ||
109 | { | ||
110 | struct clk_hw *hw; | ||
98 | 111 | ||
99 | return clk; | 112 | hw = clk_hw_register_fixed_factor(dev, name, parent_name, flags, mult, |
113 | div); | ||
114 | if (IS_ERR(hw)) | ||
115 | return ERR_CAST(hw); | ||
116 | return hw->clk; | ||
100 | } | 117 | } |
101 | EXPORT_SYMBOL_GPL(clk_register_fixed_factor); | 118 | EXPORT_SYMBOL_GPL(clk_register_fixed_factor); |
102 | 119 | ||
@@ -113,6 +130,17 @@ void clk_unregister_fixed_factor(struct clk *clk) | |||
113 | } | 130 | } |
114 | EXPORT_SYMBOL_GPL(clk_unregister_fixed_factor); | 131 | EXPORT_SYMBOL_GPL(clk_unregister_fixed_factor); |
115 | 132 | ||
133 | void clk_hw_unregister_fixed_factor(struct clk_hw *hw) | ||
134 | { | ||
135 | struct clk_fixed_factor *fix; | ||
136 | |||
137 | fix = to_clk_fixed_factor(hw); | ||
138 | |||
139 | clk_hw_unregister(hw); | ||
140 | kfree(fix); | ||
141 | } | ||
142 | EXPORT_SYMBOL_GPL(clk_hw_unregister_fixed_factor); | ||
143 | |||
116 | #ifdef CONFIG_OF | 144 | #ifdef CONFIG_OF |
117 | /** | 145 | /** |
118 | * of_fixed_factor_clk_setup() - Setup function for simple fixed factor clock | 146 | * of_fixed_factor_clk_setup() - Setup function for simple fixed factor clock |