diff options
author | Krzysztof Kozlowski <k.kozlowski@samsung.com> | 2014-05-21 07:22:59 -0400 |
---|---|---|
committer | Mike Turquette <mturquette@linaro.org> | 2014-05-23 18:44:02 -0400 |
commit | bf416bd457389bfe7371ba9074bcbd032d7a04cc (patch) | |
tree | 14b00aa4d7524761b0e9a6a90438b9272a365076 | |
parent | 42dd880e678061aa1b26c69579a2dbb8f9532460 (diff) |
clk: s2mps11: Add missing of_node_put and of_clk_del_provider
Add of_clk_del_provider to remove previously registered clock provider.
Add of_node_put to decrement the ref count of clock nodes.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
-rw-r--r-- | drivers/clk/clk-s2mps11.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c index f2f62a1bf61a..843ec3646501 100644 --- a/drivers/clk/clk-s2mps11.c +++ b/drivers/clk/clk-s2mps11.c | |||
@@ -44,6 +44,7 @@ enum { | |||
44 | 44 | ||
45 | struct s2mps11_clk { | 45 | struct s2mps11_clk { |
46 | struct sec_pmic_dev *iodev; | 46 | struct sec_pmic_dev *iodev; |
47 | struct device_node *clk_np; | ||
47 | struct clk_hw hw; | 48 | struct clk_hw hw; |
48 | struct clk *clk; | 49 | struct clk *clk; |
49 | struct clk_lookup *lookup; | 50 | struct clk_lookup *lookup; |
@@ -156,7 +157,6 @@ static int s2mps11_clk_probe(struct platform_device *pdev) | |||
156 | { | 157 | { |
157 | struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent); | 158 | struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent); |
158 | struct s2mps11_clk *s2mps11_clks, *s2mps11_clk; | 159 | struct s2mps11_clk *s2mps11_clks, *s2mps11_clk; |
159 | struct device_node *clk_np = NULL; | ||
160 | unsigned int s2mps11_reg; | 160 | unsigned int s2mps11_reg; |
161 | int i, ret = 0; | 161 | int i, ret = 0; |
162 | u32 val; | 162 | u32 val; |
@@ -168,9 +168,10 @@ static int s2mps11_clk_probe(struct platform_device *pdev) | |||
168 | 168 | ||
169 | s2mps11_clk = s2mps11_clks; | 169 | s2mps11_clk = s2mps11_clks; |
170 | 170 | ||
171 | clk_np = s2mps11_clk_parse_dt(pdev); | 171 | /* Store clocks of_node in first element of s2mps11_clks array */ |
172 | if (IS_ERR(clk_np)) | 172 | s2mps11_clks->clk_np = s2mps11_clk_parse_dt(pdev); |
173 | return PTR_ERR(clk_np); | 173 | if (IS_ERR(s2mps11_clks->clk_np)) |
174 | return PTR_ERR(s2mps11_clks->clk_np); | ||
174 | 175 | ||
175 | switch(platform_get_device_id(pdev)->driver_data) { | 176 | switch(platform_get_device_id(pdev)->driver_data) { |
176 | case S2MPS11X: | 177 | case S2MPS11X: |
@@ -225,7 +226,8 @@ static int s2mps11_clk_probe(struct platform_device *pdev) | |||
225 | 226 | ||
226 | clk_data.clks = clk_table; | 227 | clk_data.clks = clk_table; |
227 | clk_data.clk_num = S2MPS11_CLKS_NUM; | 228 | clk_data.clk_num = S2MPS11_CLKS_NUM; |
228 | of_clk_add_provider(clk_np, of_clk_src_onecell_get, &clk_data); | 229 | of_clk_add_provider(s2mps11_clks->clk_np, |
230 | of_clk_src_onecell_get, &clk_data); | ||
229 | } | 231 | } |
230 | 232 | ||
231 | platform_set_drvdata(pdev, s2mps11_clks); | 233 | platform_set_drvdata(pdev, s2mps11_clks); |
@@ -250,6 +252,10 @@ static int s2mps11_clk_remove(struct platform_device *pdev) | |||
250 | struct s2mps11_clk *s2mps11_clks = platform_get_drvdata(pdev); | 252 | struct s2mps11_clk *s2mps11_clks = platform_get_drvdata(pdev); |
251 | int i; | 253 | int i; |
252 | 254 | ||
255 | of_clk_del_provider(s2mps11_clks[0].clk_np); | ||
256 | /* Drop the reference obtained in s2mps11_clk_parse_dt */ | ||
257 | of_node_put(s2mps11_clks[0].clk_np); | ||
258 | |||
253 | for (i = 0; i < S2MPS11_CLKS_NUM; i++) | 259 | for (i = 0; i < S2MPS11_CLKS_NUM; i++) |
254 | clkdev_drop(s2mps11_clks[i].lookup); | 260 | clkdev_drop(s2mps11_clks[i].lookup); |
255 | 261 | ||