diff mbox series

[01/11] clk: axi-clkgen: Use managed `of_clk_add_hw_provider()`

Message ID 20230410014502.27929-1-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>
---
Sorry if you received this multiple times. Forgot to cc the mailinglist.
---
 drivers/clk/clk-axi-clkgen.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:52)
> 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
Bjorn Andersson April 14, 2023, 3:37 a.m. UTC | #2
On Sun, 9 Apr 2023 18:44:52 -0700, Lars-Peter Clausen wrote:
> 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.
> 
> 

Applied, thanks!

[07/11] clk: qcom: rpm: Use managed `of_clk_add_hw_provider()`
        commit: f1f67db9d64ffb85af04dbbf59e3f213fbf86add

Best regards,
diff mbox series

Patch

diff --git a/drivers/clk/clk-axi-clkgen.c b/drivers/clk/clk-axi-clkgen.c
index 671bee55ceb3..a04a3d38c76e 100644
--- a/drivers/clk/clk-axi-clkgen.c
+++ b/drivers/clk/clk-axi-clkgen.c
@@ -553,13 +553,8 @@  static int axi_clkgen_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	return of_clk_add_hw_provider(pdev->dev.of_node, of_clk_hw_simple_get,
-				      &axi_clkgen->clk_hw);
-}
-
-static void axi_clkgen_remove(struct platform_device *pdev)
-{
-	of_clk_del_provider(pdev->dev.of_node);
+	return devm_of_clk_add_hw_provider(&pdev->dev, of_clk_hw_simple_get,
+					   &axi_clkgen->clk_hw);
 }
 
 static const struct of_device_id axi_clkgen_ids[] = {
@@ -581,7 +576,6 @@  static struct platform_driver axi_clkgen_driver = {
 		.of_match_table = axi_clkgen_ids,
 	},
 	.probe = axi_clkgen_probe,
-	.remove_new = axi_clkgen_remove,
 };
 module_platform_driver(axi_clkgen_driver);