[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181101144044.11495-4-ricardo.ribalda@gmail.com>
Date: Thu, 1 Nov 2018 15:40:42 +0100
From: Ricardo Ribalda Delgado <ricardo.ribalda@...il.com>
To: Stephen Boyd <sboyd@...nel.org>, Alan Tull <atull@...nel.org>,
linux-clk@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Ricardo Ribalda Delgado <ricardo.ribalda@...il.com>
Subject: [PATCH 3/5] clk: fixed-factor: Use devm_of_clk_add_provider
Use devm_clk_add_provider. It will take care of clk un-registering.
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@...il.com>
---
drivers/clk/clk-fixed-factor.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c
index 7df6b5b1e7ee..876d76522475 100644
--- a/drivers/clk/clk-fixed-factor.c
+++ b/drivers/clk/clk-fixed-factor.c
@@ -148,7 +148,8 @@ static const struct of_device_id set_rate_parent_matches[] = {
{ /* Sentinel */ },
};
-static struct clk *_of_fixed_factor_clk_setup(struct device_node *node)
+static struct clk *_of_fixed_factor_clk_setup(struct device *dev,
+ struct device_node *node)
{
struct clk *clk;
const char *clk_name = node->name;
@@ -187,7 +188,11 @@ static struct clk *_of_fixed_factor_clk_setup(struct device_node *node)
return clk;
}
- ret = of_clk_add_provider(node, of_clk_src_simple_get, clk);
+ if (dev)
+ ret = devm_of_clk_add_provider(dev, of_clk_src_simple_get, clk);
+ else
+ ret = of_clk_add_provider(node, of_clk_src_simple_get, clk);
+
if (ret) {
clk_unregister(clk);
return ERR_PTR(ret);
@@ -201,7 +206,7 @@ static struct clk *_of_fixed_factor_clk_setup(struct device_node *node)
*/
void __init of_fixed_factor_clk_setup(struct device_node *node)
{
- _of_fixed_factor_clk_setup(node);
+ _of_fixed_factor_clk_setup(NULL, node);
}
CLK_OF_DECLARE(fixed_factor_clk, "fixed-factor-clock",
of_fixed_factor_clk_setup);
@@ -210,7 +215,6 @@ static int of_fixed_factor_clk_remove(struct platform_device *pdev)
{
struct clk *clk = platform_get_drvdata(pdev);
- of_clk_del_provider(pdev->dev.of_node);
clk_unregister_fixed_factor(clk);
return 0;
@@ -224,7 +228,7 @@ static int of_fixed_factor_clk_probe(struct platform_device *pdev)
* This function is not executed when of_fixed_factor_clk_setup
* succeeded.
*/
- clk = _of_fixed_factor_clk_setup(pdev->dev.of_node);
+ clk = _of_fixed_factor_clk_setup(&pdev->dev, pdev->dev.of_node);
if (IS_ERR(clk))
return PTR_ERR(clk);
--
2.19.1
Powered by blists - more mailing lists