diff mbox series

[05/11] clk: hsdk-pll: Use managed `of_clk_add_hw_provider()`

Message ID 20230410014502.27929-5-lars@metafoo.de (mailing list archive)
State Accepted, archived
Headers show
Series [01/11] clk: axi-clkgen: Use managed `of_clk_add_hw_provider()` | expand

Commit Message

Lars-Peter Clausen April 10, 2023, 1:44 a.m. UTC
Use the managed `devm_of_clk_add_hw_provider()` instead of
`of_clk_add_hw_provider()`.

This makes sure the provider gets automatically removed on unbind and
allows to completely eliminate the drivers `remove()` callback.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/clk/clk-hsdk-pll.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

Comments

Stephen Boyd April 10, 2023, 7:58 p.m. UTC | #1
Quoting Lars-Peter Clausen (2023-04-09 18:44:56)
> Use the managed `devm_of_clk_add_hw_provider()` instead of
> `of_clk_add_hw_provider()`.
> 
> This makes sure the provider gets automatically removed on unbind and
> allows to completely eliminate the drivers `remove()` callback.
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> ---

Applied to clk-next
diff mbox series

Patch

diff --git a/drivers/clk/clk-hsdk-pll.c b/drivers/clk/clk-hsdk-pll.c
index 766e139972fe..33b48ea5ea3d 100644
--- a/drivers/clk/clk-hsdk-pll.c
+++ b/drivers/clk/clk-hsdk-pll.c
@@ -346,13 +346,8 @@  static int hsdk_pll_clk_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	return of_clk_add_hw_provider(dev->of_node, of_clk_hw_simple_get,
-			&pll_clk->hw);
-}
-
-static void hsdk_pll_clk_remove(struct platform_device *pdev)
-{
-	of_clk_del_provider(pdev->dev.of_node);
+	return devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get,
+					   &pll_clk->hw);
 }
 
 static void __init of_hsdk_pll_clk_setup(struct device_node *node)
@@ -431,6 +426,5 @@  static struct platform_driver hsdk_pll_clk_driver = {
 		.of_match_table = hsdk_pll_clk_id,
 	},
 	.probe = hsdk_pll_clk_probe,
-	.remove_new = hsdk_pll_clk_remove,
 };
 builtin_platform_driver(hsdk_pll_clk_driver);