[PATCH v2 12/22] phy: cadence-torrent: use devm_of_clk_add_hw_provider()

Benjamin Robin benjamin.robin at bootlin.com
Wed Dec 2 07:08:57 PST 2026


Use devm_of_clk_add_hw_provider() instead of of_clk_add_hw_provider()
so that the clock provider is unregistered automatically, both on driver
removal and on a late probe failure.

This lets us drop the now-unnecessary cdns_torrent_clk_cleanup() helper.

No functional change intended.

Signed-off-by: Benjamin Robin <benjamin.robin at bootlin.com>
---
 drivers/phy/cadence/phy-cadence-torrent.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c
index 6e48c315e6b1..59b61dd8e54a 100644
--- a/drivers/phy/cadence/phy-cadence-torrent.c
+++ b/drivers/phy/cadence/phy-cadence-torrent.c
@@ -2348,17 +2348,9 @@ int cdns_torrent_phy_configure_multilink(struct tp_data *tp_data)
 	return 0;
 }
 
-static void cdns_torrent_clk_cleanup(struct tp_data *tp_data)
-{
-	struct device *dev = tp_data->dev;
-
-	of_clk_del_provider(dev->of_node);
-}
-
 static int tp_clk_register(struct tp_data *tp_data)
 {
 	struct device *dev = tp_data->dev;
-	struct device_node *node = dev->of_node;
 	struct clk_hw_onecell_data *data;
 	int ret;
 
@@ -2387,9 +2379,9 @@ static int tp_clk_register(struct tp_data *tp_data)
 		return ret;
 	}
 
-	ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, data);
+	ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, data);
 	if (ret) {
-		dev_err(dev, "Failed to add clock provider: %s\n", node->name);
+		dev_err(dev, "Failed to add clock provider\n");
 		return ret;
 	}
 
@@ -2763,7 +2755,6 @@ static int cdns_torrent_phy_probe(struct platform_device *pdev)
 	clk_disable_unprepare(tp_data->clk1);
 	clk_disable_unprepare(tp_data->clk);
 clk_cleanup:
-	cdns_torrent_clk_cleanup(tp_data);
 	return ret;
 }
 
@@ -2781,7 +2772,6 @@ static void cdns_torrent_phy_remove(struct platform_device *pdev)
 
 	clk_disable_unprepare(tp_data->clk1);
 	clk_disable_unprepare(tp_data->clk);
-	cdns_torrent_clk_cleanup(tp_data);
 }
 
 /* Multilink PCIe and USB Same SSC link configuration */

-- 
2.56.1




More information about the linux-arm-kernel mailing list