Skip to contentSkip to conversation

clk: axi-clkgen: Use managed `of_clk_add_hw_provider()`

PATCH Applied Lars-Peter Clausen 3 participants 23 messages Apr 10, 2023 – Apr 14, 2023

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

PATCH 1/11 clk: axi-clkgen: Use managed `of_clk_add_hw_provider()`

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.

---
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(-)
drivers/clk/clk-axi-clkgen.c +2 -8
index 671bee55ceb3..a04a3d38c76e 100644
@@ -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);
 
Signature · 1 line
2.30.2
#1 lore raw

PATCH 2/11 clk: axm5516: Use managed `of_clk_add_hw_provider()`

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.

---
 drivers/clk/clk-axm5516.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/clk/clk-axm5516.c +1 -7
index 1dff2017ad9d..1afcfdf2e6f9 100644
@@ -569,17 +569,11 @@ static int axmclk_probe(struct platform_device *pdev)
 			return ret;
 	}
 
-	return of_clk_add_hw_provider(dev->of_node, of_clk_axmclk_get, NULL);
-}
-
-static void axmclk_remove(struct platform_device *pdev)
-{
-	of_clk_del_provider(pdev->dev.of_node);
+	return devm_of_clk_add_hw_provider(dev, of_clk_axmclk_get, NULL);
 }
 
 static struct platform_driver axmclk_driver = {
 	.probe		= axmclk_probe,
-	.remove_new	= axmclk_remove,
 	.driver		= {
 		.name	= "clk-axm5516",
 		.of_match_table = axmclk_match_table,
Signature · 1 line
2.30.2
maintainer Applied
#2 lore raw

Re: [PATCH 02/11] clk: axm5516: Use managed `of_clk_add_hw_provider()`

Quoting Lars-Peter Clausen (2023-04-09 18:44:53)

Quoted 8 lines

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 to clk-next

#3 lore raw

PATCH 3/11 clk: axs10x: Use managed `of_clk_add_hw_provider()`

In reply to Lars-Peter Clausen

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.

---
 drivers/clk/axs10x/pll_clock.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/clk/axs10x/pll_clock.c +2 -8
index dbbfa12e530d..242bf5d75bab 100644
@@ -253,13 +253,8 @@ static int axs10x_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 axs10x_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_axs10x_pll_clk_setup(struct device_node *node)
@@ -331,7 +326,6 @@ static struct platform_driver axs10x_pll_clk_driver = {
 		.of_match_table = axs10x_pll_clk_id,
 	},
 	.probe = axs10x_pll_clk_probe,
-	.remove_new = axs10x_pll_clk_remove,
 };
 builtin_platform_driver(axs10x_pll_clk_driver);
 
Signature · 1 line
2.30.2
maintainer Applied
#4 lore raw

Re: [PATCH 03/11] clk: axs10x: Use managed `of_clk_add_hw_provider()`

Quoting Lars-Peter Clausen (2023-04-09 18:44:54)

Quoted 7 lines

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 to clk-next

#5 lore raw

PATCH 4/11 clk: cdce706: Use managed `of_clk_add_hw_provider()`

In reply to Lars-Peter Clausen

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.

---
 drivers/clk/clk-cdce706.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/clk/clk-cdce706.c +2 -9
index 1449d0537674..d8bee8180a6b 100644
@@ -661,16 +661,10 @@ static int cdce706_probe(struct i2c_client *client)
 	ret = cdce706_register_clkouts(cdce);
 	if (ret < 0)
 		return ret;
-	return of_clk_add_hw_provider(client->dev.of_node, of_clk_cdce_get,
-				      cdce);
+	return devm_of_clk_add_hw_provider(&client->dev, of_clk_cdce_get,
+					   cdce);
 }
 
-static void cdce706_remove(struct i2c_client *client)
-{
-	of_clk_del_provider(client->dev.of_node);
-}
-
-
 #ifdef CONFIG_OF
 static const struct of_device_id cdce706_dt_match[] = {
 	{ .compatible = "ti,cdce706" },
@@ -691,7 +685,6 @@ static struct i2c_driver cdce706_i2c_driver = {
 		.of_match_table = of_match_ptr(cdce706_dt_match),
 	},
 	.probe_new	= cdce706_probe,
-	.remove		= cdce706_remove,
 	.id_table	= cdce706_id,
 };
 module_i2c_driver(cdce706_i2c_driver);
Signature · 1 line
2.30.2
maintainer Applied
#6 lore raw

Re: [PATCH 04/11] clk: cdce706: Use managed `of_clk_add_hw_provider()`

Quoting Lars-Peter Clausen (2023-04-09 18:44:55)

Quoted 8 lines

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 to clk-next

#7 lore raw

PATCH 5/11 clk: hsdk-pll: Use managed `of_clk_add_hw_provider()`

In reply to Lars-Peter Clausen

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.

---
 drivers/clk/clk-hsdk-pll.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/clk/clk-hsdk-pll.c +2 -8
index 766e139972fe..33b48ea5ea3d 100644
@@ -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);
Signature · 1 line
2.30.2
maintainer Applied
#8 lore raw

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

Quoting Lars-Peter Clausen (2023-04-09 18:44:56)

Quoted 8 lines

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 to clk-next

#9 lore raw

PATCH 6/11 clk: lmk04832: Use managed `of_clk_add_hw_provider()`

In reply to Lars-Peter Clausen

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.

---
 drivers/clk/clk-lmk04832.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/clk/clk-lmk04832.c +2 -3
index 57485356de4c..afdfee3b365f 100644
@@ -1522,8 +1522,8 @@ static int lmk04832_probe(struct spi_device *spi)
 	}
 
 	lmk->clk_data->num = info->num_channels;
-	ret = of_clk_add_hw_provider(lmk->dev->of_node, of_clk_hw_onecell_get,
-				     lmk->clk_data);
+	ret = devm_of_clk_add_hw_provider(lmk->dev, of_clk_hw_onecell_get,
+					  lmk->clk_data);
 	if (ret) {
 		dev_err(lmk->dev, "failed to add provider (%d)\n", ret);
 		goto err_disable_vco;
@@ -1547,7 +1547,6 @@ static void lmk04832_remove(struct spi_device *spi)
 	struct lmk04832 *lmk = spi_get_drvdata(spi);
 
 	clk_disable_unprepare(lmk->oscin);
-	of_clk_del_provider(spi->dev.of_node);
 }
 
 static const struct spi_device_id lmk04832_id[] = {
Signature · 1 line
2.30.2
maintainer Applied
#10 lore raw

Re: [PATCH 06/11] clk: lmk04832: Use managed `of_clk_add_hw_provider()`

Quoting Lars-Peter Clausen (2023-04-09 18:44:57)

Quoted 7 lines

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.

---

Applied to clk-next

#11 lore raw

PATCH 7/11 clk: qcom: rpm: Use managed `of_clk_add_hw_provider()`

In reply to Lars-Peter Clausen

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.

---
 drivers/clk/qcom/clk-rpm.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/clk/qcom/clk-rpm.c +2 -9
index b1be5b664bf3..cac623e27b0e 100644
@@ -580,8 +580,8 @@ static int rpm_clk_probe(struct platform_device *pdev)
 			goto err;
 	}
 
-	ret = of_clk_add_hw_provider(pdev->dev.of_node, qcom_rpm_clk_hw_get,
-				     rcc);
+	ret = devm_of_clk_add_hw_provider(&pdev->dev, qcom_rpm_clk_hw_get,
+					  rcc);
 	if (ret)
 		goto err;
 
@@ -591,19 +591,12 @@ static int rpm_clk_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int rpm_clk_remove(struct platform_device *pdev)
-{
-	of_clk_del_provider(pdev->dev.of_node);
-	return 0;
-}
-
 static struct platform_driver rpm_clk_driver = {
 	.driver = {
 		.name = "qcom-clk-rpm",
 		.of_match_table = rpm_clk_match_table,
 	},
 	.probe = rpm_clk_probe,
-	.remove = rpm_clk_remove,
 };
 
 static int __init rpm_clk_init(void)
Signature · 1 line
2.30.2
maintainer Reviewed-by on v1 7/11
#12 lore raw

Re: [PATCH 07/11] clk: qcom: rpm: Use managed `of_clk_add_hw_provider()`

Quoting Lars-Peter Clausen (2023-04-09 18:44:58)

Quoted 8 lines

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.

---

Needs to go via qcom clk tree.

#13 lore raw

PATCH 8/11 clk: si514: Use managed `of_clk_add_hw_provider()`

In reply to Lars-Peter Clausen

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.

---
 drivers/clk/clk-si514.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/clk/clk-si514.c +2 -8
index c028fa103bed..cabdd8e8f4db 100644
@@ -360,8 +360,8 @@ static int si514_probe(struct i2c_client *client)
 		dev_err(&client->dev, "clock registration failed\n");
 		return err;
 	}
-	err = of_clk_add_hw_provider(client->dev.of_node, of_clk_hw_simple_get,
-				     &data->hw);
+	err = devm_of_clk_add_hw_provider(&client->dev, of_clk_hw_simple_get,
+					  &data->hw);
 	if (err) {
 		dev_err(&client->dev, "unable to add clk provider\n");
 		return err;
@@ -370,11 +370,6 @@ static int si514_probe(struct i2c_client *client)
 	return 0;
 }
 
-static void si514_remove(struct i2c_client *client)
-{
-	of_clk_del_provider(client->dev.of_node);
-}
-
 static const struct i2c_device_id si514_id[] = {
 	{ "si514", 0 },
 	{ }
@@ -393,7 +388,6 @@ static struct i2c_driver si514_driver = {
 		.of_match_table = clk_si514_of_match,
 	},
 	.probe_new	= si514_probe,
-	.remove		= si514_remove,
 	.id_table	= si514_id,
 };
 module_i2c_driver(si514_driver);
Signature · 1 line
2.30.2
maintainer Applied
#14 lore raw

Re: [PATCH 08/11] clk: si514: Use managed `of_clk_add_hw_provider()`

Quoting Lars-Peter Clausen (2023-04-09 18:44:59)

Quoted 7 lines

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 to clk-next

#15 lore raw

PATCH 9/11 clk: si570: Use managed `of_clk_add_hw_provider()`

In reply to Lars-Peter Clausen

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.

---
 drivers/clk/clk-si570.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/clk/clk-si570.c +3 -11
index 0a6d70c49726..0b834e9efb4b 100644
@@ -474,8 +474,8 @@ static int si570_probe(struct i2c_client *client)
 		dev_err(&client->dev, "clock registration failed\n");
 		return err;
 	}
-	err = of_clk_add_hw_provider(client->dev.of_node, of_clk_hw_simple_get,
-				     &data->hw);
+	err = devm_of_clk_add_hw_provider(&client->dev, of_clk_hw_simple_get,
+					  &data->hw);
 	if (err) {
 		dev_err(&client->dev, "unable to add clk provider\n");
 		return err;
@@ -485,10 +485,8 @@ static int si570_probe(struct i2c_client *client)
 	if (!of_property_read_u32(client->dev.of_node, "clock-frequency",
 				&initial_fout)) {
 		err = clk_set_rate(data->hw.clk, initial_fout);
-		if (err) {
-			of_clk_del_provider(client->dev.of_node);
+		if (err)
 			return err;
-		}
 	}
 
 	/* Display a message indicating that we've successfully registered */
@@ -498,11 +496,6 @@ static int si570_probe(struct i2c_client *client)
 	return 0;
 }
 
-static void si570_remove(struct i2c_client *client)
-{
-	of_clk_del_provider(client->dev.of_node);
-}
-
 static const struct of_device_id clk_si570_of_match[] = {
 	{ .compatible = "silabs,si570" },
 	{ .compatible = "silabs,si571" },
@@ -518,7 +511,6 @@ static struct i2c_driver si570_driver = {
 		.of_match_table = clk_si570_of_match,
 	},
 	.probe_new	= si570_probe,
-	.remove		= si570_remove,
 	.id_table	= si570_id,
 };
 module_i2c_driver(si570_driver);
Signature · 1 line
2.30.2
maintainer Applied
#16 lore raw

Re: [PATCH 09/11] clk: si570: Use managed `of_clk_add_hw_provider()`

Quoting Lars-Peter Clausen (2023-04-09 18:45:00)

Quoted 8 lines

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 to clk-next

#17 lore raw

PATCH 10/11 clk: si5351: Use managed `of_clk_add_hw_provider()`

In reply to Lars-Peter Clausen

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.

---
 drivers/clk/clk-si5351.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/clk/clk-si5351.c +2 -8
index 9e939c98a455..4fcf7056717e 100644
@@ -1641,8 +1641,8 @@ static int si5351_i2c_probe(struct i2c_client *client)
 		}
 	}
 
-	ret = of_clk_add_hw_provider(client->dev.of_node, si53351_of_clk_get,
-				     drvdata);
+	ret = devm_of_clk_add_hw_provider(&client->dev, si53351_of_clk_get,
+					  drvdata);
 	if (ret) {
 		dev_err(&client->dev, "unable to add clk provider\n");
 		return ret;
@@ -1651,18 +1651,12 @@ static int si5351_i2c_probe(struct i2c_client *client)
 	return 0;
 }
 
-static void si5351_i2c_remove(struct i2c_client *client)
-{
-	of_clk_del_provider(client->dev.of_node);
-}
-
 static struct i2c_driver si5351_driver = {
 	.driver = {
 		.name = "si5351",
 		.of_match_table = of_match_ptr(si5351_dt_ids),
 	},
 	.probe_new = si5351_i2c_probe,
-	.remove = si5351_i2c_remove,
 	.id_table = si5351_i2c_ids,
 };
 module_i2c_driver(si5351_driver);
Signature · 1 line
2.30.2
maintainer Applied
#18 lore raw

Re: [PATCH 10/11] clk: si5351: Use managed `of_clk_add_hw_provider()`

Quoting Lars-Peter Clausen (2023-04-09 18:45:01)

Quoted 8 lines

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 to clk-next

#19 lore raw

PATCH 11/11 clk: uniphier: Use managed `of_clk_add_hw_provider()`

In reply to Lars-Peter Clausen

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.

---
 drivers/clk/uniphier/clk-uniphier-core.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/clk/uniphier/clk-uniphier-core.c +2 -8
index 92f4ddc593db..a61213311d6c 100644
@@ -87,13 +87,8 @@ static int uniphier_clk_probe(struct platform_device *pdev)
 			hw_data->hws[p->idx] = hw;
 	}
 
-	return of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get,
-				      hw_data);
-}
-
-static void uniphier_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_onecell_get,
+					   hw_data);
 }
 
 static const struct of_device_id uniphier_clk_match[] = {
@@ -218,7 +213,6 @@ static const struct of_device_id uniphier_clk_match[] = {
 
 static struct platform_driver uniphier_clk_driver = {
 	.probe = uniphier_clk_probe,
-	.remove_new = uniphier_clk_remove,
 	.driver = {
 		.name = "uniphier-clk",
 		.of_match_table = uniphier_clk_match,
Signature · 1 line
2.30.2
maintainer Applied
#20 lore raw

Re: [PATCH 11/11] clk: uniphier: Use managed `of_clk_add_hw_provider()`

Quoting Lars-Peter Clausen (2023-04-09 18:45:02)

Quoted 8 lines

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 to clk-next

maintainer Applied
#22 lore raw

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

In reply to Lars-Peter Clausen
Quoted 6 lines · Lars-Peter Clausen

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,

Signature · 1 line
Bjorn Andersson <[email protected]>