Skip to contentSkip to conversation

clk: Improve consumer field in debugfs clk_summary

PATCH In review Geert Uytterhoeven 3 participants 13 messages Nov 19 – Nov 20

Subsystems (14)
lore
Share & tools
lore

Geert Uytterhoeven

author maintainer
#0 lore raw

cover clk: Improve consumer field in debugfs clk_summary

Hi all,

When a driver uses of_clk_get_from_provider() to obtain clocks, the latter show up as "deviceless" in the consumer column of the clk_summary file in debugfs.

This patch series aims to improve that, by introducing a new variant dev_clk_get_from_provider() that also takes a consumer device. When callers provide it, the consumer's name will be shown in the clk_summary output.

Sample clk_summary change snippet on R-Car H1 Marzen:
- sata 1 1 0 62500000 0 0 50000 Y deviceless of_clk_get_from_provider
+ sata 1 1 0 62500000 0 0 50000 Y fc600000.sata dev_clk_get_from_provider

Overview:
- The first patch removes the unused "dev" member from struct clk and the "dev" parameter from clk_hw_create_clk(): it felt wrong to add yet another user of clk_hw_create_clk() passing a useless device pointer,
- The second patch introduces the new dev_clk_get_from_provider() function,
- Patches 3-6 convert users to the new helper:
- The Renesas clock patch was tested on R-Car H1 and H3, and should work fine on other Renesas SoCs,
- The Rockchip HDMI patch was only compile-tested, but is probably fine, too,
- The OMAP2+ patch definitely needs testing,
- The Renesas pmdomain patch depends on work in progress.

This series has been tested on R-Car H1, H3, and X5H.

Thanks for your comments!

Geert Uytterhoeven (6):
clk: Remove unused clk.dev
clk: Add dev_clk_get_from_provider()
clk: renesas: Convert to dev_clk_get_from_provider() [RFT] drm/rockchip: dw_hdmi: Convert to dev_clk_get_from_provider() [RFT] ARM: OMAP2+: Convert to dev_clk_get_from_provider() [RFC] pmdomain: renesas: r8a78000: Convert to
dev_clk_get_from_provider()

 arch/arm/mach-omap2/omap_device.c           |  2 +-
 arch/arm/mach-omap2/omap_hwmod.c            |  3 ++-
 drivers/clk/clk.c                           | 23 ++++++++++-----------
 drivers/clk/clk.h                           | 11 ++++------
 drivers/clk/clkdev.c                        | 14 ++++---------
 drivers/clk/renesas/clk-mstp.c              |  2 +-
 drivers/clk/renesas/r9a06g032-clocks.c      |  2 +-
 drivers/clk/renesas/renesas-cpg-mssr.c      |  2 +-
 drivers/clk/renesas/rzg2l-cpg.c             |  2 +-
 drivers/clk/renesas/rzv2h-cpg.c             |  2 +-
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c |  3 ++-
 drivers/pmdomain/renesas/r8a78000-mdlc.c    |  2 +-
 include/linux/clk.h                         | 10 +++++++--
 13 files changed, 38 insertions(+), 40 deletions(-)
Signature · 12 lines
2.43.0

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds
author maintainer
#1 lore raw

PATCH 1/6 clk: Remove unused clk.dev

This basically reverts commit efa850487a6b6742 ("clk: Inform the core about consumer devices").

This commit added a struct device pointer member to struct clk and a parameter to clk_hw_create_clk(), but the new member was never used beyond setting.

---
 drivers/clk/clk.c    | 14 +++++---------
 drivers/clk/clk.h    | 11 ++++-------
 drivers/clk/clkdev.c | 14 ++++----------
 3 files changed, 13 insertions(+), 26 deletions(-)
drivers/clk/clk.c +5 -9
index 673eac47450b1e1c..858f4d60ed2d97c4 100644
@@ -160,7 +160,6 @@ struct clk_core {
 
 struct clk {
 	struct clk_core	*core;
-	struct device *dev;
 	const char *dev_id;
 	const char *con_id;
 	unsigned long min_rate;
@@ -4249,7 +4248,6 @@ static void free_clk(struct clk *clk)
 /**
  * clk_hw_create_clk: Allocate and link a clk consumer to a clk_core given
  * a clk_hw
- * @dev: clk consumer device
  * @hw: clk_hw associated with the clk being consumed
  * @dev_id: string describing device name
  * @con_id: connection ID string on device
@@ -4259,9 +4257,8 @@ static void free_clk(struct clk *clk)
  * consumers. It connects a consumer to the clk_core and clk_hw structures
  * used by the framework and clk provider respectively.
  */
-struct clk *clk_hw_create_clk(struct device *dev, struct clk_hw *hw,
-			      const char *dev_id, const char *con_id,
-			      struct module *owner)
+struct clk *clk_hw_create_clk(struct clk_hw *hw, const char *dev_id,
+			      const char *con_id, struct module *owner)
 {
 	struct clk *clk;
 	struct clk_core *core;
@@ -4274,7 +4271,6 @@ struct clk *clk_hw_create_clk(struct device *dev, struct clk_hw *hw,
 	clk = alloc_clk(core, dev_id, con_id);
 	if (IS_ERR(clk))
 		return clk;
-	clk->dev = dev;
 
 	/*
 	 * Pin the provider module only when the consumer lives in a different
@@ -4303,7 +4299,7 @@ struct clk *__clk_hw_get_clk(struct clk_hw *hw, const char *con_id,
 	struct device *dev = hw->core->dev;
 	const char *name = dev ? dev_name(dev) : NULL;
 
-	return clk_hw_create_clk(dev, hw, name, con_id, owner);
+	return clk_hw_create_clk(hw, name, con_id, owner);
 }
 EXPORT_SYMBOL(__clk_hw_get_clk);
 
@@ -5392,7 +5388,7 @@ struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec)
 {
 	struct clk_hw *hw = of_clk_get_hw_from_clkspec(clkspec);
 
-	return clk_hw_create_clk(NULL, hw, NULL, __func__, NULL);
+	return clk_hw_create_clk(hw, NULL, __func__, NULL);
 }
 EXPORT_SYMBOL_GPL(of_clk_get_from_provider);
 
@@ -5420,7 +5416,7 @@ static struct clk *__of_clk_get(struct device_node *np,
 {
 	struct clk_hw *hw = of_clk_get_hw(np, index, con_id);
 
-	return clk_hw_create_clk(NULL, hw, dev_id, con_id, NULL);
+	return clk_hw_create_clk(hw, dev_id, con_id, NULL);
 }
 
 struct clk *of_clk_get(struct device_node *np, int index)
drivers/clk/clk.h +4 -7
index 5009380863a9dc6f..ba23700149de0445 100644
@@ -5,8 +5,6 @@
  */
 
 struct clk_hw;
-struct device;
-struct of_phandle_args;
 
 #if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK)
 struct clk_hw *of_clk_get_hw(struct device_node *np,
@@ -22,15 +20,14 @@ static inline struct clk_hw *of_clk_get_hw(struct device_node *np,
 struct clk_hw *clk_find_hw(const char *dev_id, const char *con_id);
 
 #ifdef CONFIG_COMMON_CLK
-struct clk *clk_hw_create_clk(struct device *dev, struct clk_hw *hw,
-			      const char *dev_id, const char *con_id,
-			      struct module *owner);
+struct clk *clk_hw_create_clk(struct clk_hw *hw, const char *dev_id,
+			      const char *con_id, struct module *owner);
 void __clk_put(struct clk *clk);
 #else
 /* All these casts to avoid ifdefs in clkdev... */
 static inline struct clk *
-clk_hw_create_clk(struct device *dev, struct clk_hw *hw, const char *dev_id,
-		  const char *con_id, struct module *owner)
+clk_hw_create_clk(struct clk_hw *hw, const char *dev_id, const char *con_id,
+		  struct module *owner)
 {
 	return (struct clk *)hw;
 }
drivers/clk/clkdev.c +4 -10
index 919fc680ae4dd6ec..e963f878290564da 100644
@@ -83,17 +83,11 @@ struct clk_hw *clk_find_hw(const char *dev_id, const char *con_id)
 	return hw;
 }
 
-static struct clk *__clk_get_sys(struct device *dev, const char *dev_id,
-				 const char *con_id)
+struct clk *clk_get_sys(const char *dev_id, const char *con_id)
 {
 	struct clk_hw *hw = clk_find_hw(dev_id, con_id);
 
-	return clk_hw_create_clk(dev, hw, dev_id, con_id, NULL);
-}
-
-struct clk *clk_get_sys(const char *dev_id, const char *con_id)
-{
-	return __clk_get_sys(NULL, dev_id, con_id);
+	return clk_hw_create_clk(hw, dev_id, con_id, NULL);
 }
 EXPORT_SYMBOL(clk_get_sys);
 
@@ -105,10 +99,10 @@ struct clk *clk_get(struct device *dev, const char *con_id)
 	if (dev && dev->of_node) {
 		hw = of_clk_get_hw(dev->of_node, 0, con_id);
 		if (!IS_ERR(hw) || PTR_ERR(hw) == -EPROBE_DEFER)
-			return clk_hw_create_clk(dev, hw, dev_id, con_id, NULL);
+			return clk_hw_create_clk(hw, dev_id, con_id, NULL);
 	}
 
-	return __clk_get_sys(dev, dev_id, con_id);
+	return clk_get_sys(dev_id, con_id);
 }
 EXPORT_SYMBOL(clk_get);
 
Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH 1/6] clk: Remove unused clk.dev

Quoted 86 lines

This basically reverts commit efa850487a6b6742 ("clk: Inform the core about consumer devices").

This commit added a struct device pointer member to struct clk and a parameter to clk_hw_create_clk(), but the new member was never used beyond setting.

---
 drivers/clk/clk.c    | 14 +++++---------
 drivers/clk/clk.h    | 11 ++++-------
 drivers/clk/clkdev.c | 14 ++++----------
 3 files changed, 13 insertions(+), 26 deletions(-)
drivers/clk/clk.c +5 -9
index 673eac47450b..858f4d60ed2d 100644
@@ -160,7 +160,6 @@ struct clk_core {
 
 struct clk {
 	struct clk_core	*core;
-	struct device *dev;
 	const char *dev_id;
 	const char *con_id;
 	unsigned long min_rate;
@@ -4249,7 +4248,6 @@ static void free_clk(struct clk *clk)
 /**
  * clk_hw_create_clk: Allocate and link a clk consumer to a clk_core given
  * a clk_hw
- * @dev: clk consumer device
  * @hw: clk_hw associated with the clk being consumed
  * @dev_id: string describing device name
  * @con_id: connection ID string on device
@@ -4259,9 +4257,8 @@ static void free_clk(struct clk *clk)
  * consumers. It connects a consumer to the clk_core and clk_hw structures
  * used by the framework and clk provider respectively.
  */
-struct clk *clk_hw_create_clk(struct device *dev, struct clk_hw *hw,
-			      const char *dev_id, const char *con_id,
-			      struct module *owner)
+struct clk *clk_hw_create_clk(struct clk_hw *hw, const char *dev_id,
+			      const char *con_id, struct module *owner)
 {
 	struct clk *clk;
 	struct clk_core *core;
@@ -4274,7 +4271,6 @@ struct clk *clk_hw_create_clk(struct device *dev, struct clk_hw *hw,
 	clk = alloc_clk(core, dev_id, con_id);
 	if (IS_ERR(clk))
 		return clk;
-	clk->dev = dev;
 
 	/*
 	 * Pin the provider module only when the consumer lives in a different
@@ -4303,7 +4299,7 @@ struct clk *__clk_hw_get_clk(struct clk_hw *hw, const char *con_id,
 	struct device *dev = hw->core->dev;
 	const char *name = dev ? dev_name(dev) : NULL;
 
-	return clk_hw_create_clk(dev, hw, name, con_id, owner);
+	return clk_hw_create_clk(hw, name, con_id, owner);
 }
 EXPORT_SYMBOL(__clk_hw_get_clk);
 
@@ -5392,7 +5388,7 @@ struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec)
 {
 	struct clk_hw *hw = of_clk_get_hw_from_clkspec(clkspec);
 
-	return clk_hw_create_clk(NULL, hw, NULL, __func__, NULL);
+	return clk_hw_create_clk(hw, NULL, __func__, NULL);
 }
 EXPORT_SYMBOL_GPL(of_clk_get_from_provider);
 
@@ -5420,7 +5416,7 @@ static struct clk *__of_clk_get(struct device_node *np,
 {
 	struct clk_hw *hw = of_clk_get_hw(np, index, con_id);
 
-	return clk_hw_create_clk(NULL, hw, dev_id, con_id, NULL);
+	return clk_hw_create_clk(hw, dev_id, con_id, NULL);
 }
 
 struct clk *of_clk_get(struct device_node *np, int index)
drivers/clk/clk.h +0 -0
index 5009380863a9..ba23700149de 100644

drivers/clk/clk.h line 9

Quoted 5 lines
drivers/clk/clk.h +0 -2
@@ -5,8 +5,6 @@
  */
 
 struct clk_hw;
-struct device;
-struct of_phandle_args;

Did you mean to remove of_phandle_args?

Otherwise this looks good to me.

Brian

Signature · 1 line
Brian Masney <[email protected]>
author maintainer
#3 lore raw

PATCH 2/6 clk: Add dev_clk_get_from_provider()

In reply to Geert Uytterhoeven

Clocks obtained through of_clk_get_from_provider() show up as "deviceless" in the consumer column of the clk_summary file in debugfs. Add a new variant dev_clk_get_from_provider() that also takes a consumer device, so callers can provide it, and consumer's name will be shown in the clk_summary output.

Reimplement of_clk_get_from_provider() on top of
dev_clk_get_from_provider().

---
 drivers/clk/clk.c   | 11 +++++++----
 include/linux/clk.h | 10 ++++++++--
 2 files changed, 15 insertions(+), 6 deletions(-)
drivers/clk/clk.c +7 -4
index 858f4d60ed2d97c4..195c7d80e4f2b579 100644
@@ -5377,20 +5377,23 @@ of_clk_get_hw_from_clkspec(struct of_phandle_args *clkspec)
 }
 
 /**
- * of_clk_get_from_provider() - Lookup a clock from a clock provider
+ * dev_clk_get_from_provider() - Lookup a clock from a clock provider
+ * @dev: clk consumer device
  * @clkspec: pointer to a clock specifier data structure
  *
  * This function looks up a struct clk from the registered list of clock
  * providers, an input is a clock specifier data structure as returned
  * from the OF phandle parser.
  */
-struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec)
+struct clk *dev_clk_get_from_provider(struct device *dev,
+				      struct of_phandle_args *clkspec)
 {
 	struct clk_hw *hw = of_clk_get_hw_from_clkspec(clkspec);
+	const char *name = dev ? dev_name(dev) : NULL;
 
-	return clk_hw_create_clk(hw, NULL, __func__, NULL);
+	return clk_hw_create_clk(hw, name, __func__, NULL);
 }
-EXPORT_SYMBOL_GPL(of_clk_get_from_provider);
+EXPORT_SYMBOL_GPL(dev_clk_get_from_provider);
 
 struct clk_hw *of_clk_get_hw(struct device_node *np, int index,
 			     const char *con_id)
include/linux/clk.h +8 -2
index db9cf184fd999b85..45c6eb09436036bb 100644
@@ -1261,7 +1261,8 @@ static inline struct clk *clk_get_optional(struct device *dev, const char *id)
 #if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK)
 struct clk *of_clk_get(struct device_node *np, int index);
 struct clk *of_clk_get_by_name(struct device_node *np, const char *name);
-struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec);
+struct clk *dev_clk_get_from_provider(struct device *dev,
+				      struct of_phandle_args *clkspec);
 #else
 static inline struct clk *of_clk_get(struct device_node *np, int index)
 {
@@ -1272,10 +1273,15 @@ static inline struct clk *of_clk_get_by_name(struct device_node *np,
 {
 	return ERR_PTR(-ENOENT);
 }
-static inline struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec)
+static inline struct clk *dev_clk_get_from_provider(struct device *dev,
+						    struct of_phandle_args *clkspec)
 {
 	return ERR_PTR(-ENOENT);
 }
 #endif
+static inline struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec)
+{
+	return dev_clk_get_from_provider(NULL, clkspec);
+}
 
 #endif
Signature · 1 line
2.43.0
Reviewed-by on v1 2/6
#4 lore raw

Re: [PATCH 2/6] clk: Add dev_clk_get_from_provider()

Quoted 10 lines

Clocks obtained through of_clk_get_from_provider() show up as "deviceless" in the consumer column of the clk_summary file in debugfs. Add a new variant dev_clk_get_from_provider() that also takes a consumer device, so callers can provide it, and consumer's name will be shown in the clk_summary output.

Reimplement of_clk_get_from_provider() on top of
dev_clk_get_from_provider().

Signature · 1 line
Brian Masney <[email protected]>
author maintainer
#5 lore raw

PATCH 3/6 clk: renesas: Convert to dev_clk_get_from_provider()

In reply to Geert Uytterhoeven

Renesas clock domain callbacks use of_clk_get_from_provider() to obtain clocks used for power management, so the latter show up as "deviceless" in the consumer column of the clk_summary file in debugfs.

Fix this by using dev_clk_get_from_provider() instead, letting us pass the consumer device, too.

Sample clk_summary change snippet on R-Car H1 Marzen:
- sata 1 1 0 62500000 0 0 50000 Y deviceless of_clk_get_from_provider
+ sata 1 1 0 62500000 0 0 50000 Y fc600000.sata dev_clk_get_from_provider

---
Tested on R-Car H1 and H3.

---
 drivers/clk/renesas/clk-mstp.c         | 2 +-
 drivers/clk/renesas/r9a06g032-clocks.c | 2 +-
 drivers/clk/renesas/renesas-cpg-mssr.c | 2 +-
 drivers/clk/renesas/rzg2l-cpg.c        | 2 +-
 drivers/clk/renesas/rzv2h-cpg.c        | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
drivers/clk/renesas/clk-mstp.c +1 -1
index 1bd2acb7e175f9c7..79d3a0b9cf7bb08a 100644
@@ -276,7 +276,7 @@ int cpg_mstp_attach_dev(struct generic_pm_domain *unused, struct device *dev)
 	return 0;
 
 found:
-	clk = of_clk_get_from_provider(&clkspec);
+	clk = dev_clk_get_from_provider(dev, &clkspec);
 	of_node_put(clkspec.np);
 
 	if (IS_ERR(clk))
drivers/clk/renesas/r9a06g032-clocks.c +1 -1
index 871a915c24b8b609..9ae716dc6ede3438 100644
@@ -748,7 +748,7 @@ static int create_add_module_clock(struct of_phandle_args *clkspec,
 	struct clk *clk;
 	int error;
 
-	clk = of_clk_get_from_provider(clkspec);
+	clk = dev_clk_get_from_provider(dev, clkspec);
 	if (IS_ERR(clk))
 		return PTR_ERR(clk);
 
drivers/clk/renesas/renesas-cpg-mssr.c +1 -1
index 1ed11ce4a04c8b44..1fc12132acfe4a8b 100644
@@ -641,7 +641,7 @@ int cpg_mssr_attach_dev(struct generic_pm_domain *unused, struct device *dev)
 	return 0;
 
 found:
-	clk = of_clk_get_from_provider(&clkspec);
+	clk = dev_clk_get_from_provider(dev, &clkspec);
 	of_node_put(clkspec.np);
 
 	if (IS_ERR(clk))
drivers/clk/renesas/rzg2l-cpg.c +1 -1
index 06ae7228a95480fd..fb57d26947e1647c 100644
@@ -2557,7 +2557,7 @@ static int rzg2l_cpg_attach_dev(struct generic_pm_domain *domain, struct device
 				goto err;
 			}
 		}
-		clk = of_clk_get_from_provider(&clkspec);
+		clk = dev_clk_get_from_provider(dev, &clkspec);
 		of_node_put(clkspec.np);
 		if (IS_ERR(clk)) {
 			error = PTR_ERR(clk);
drivers/clk/renesas/rzv2h-cpg.c +1 -1
index fabeaef8e62fba33..4b685f7250f661bd 100644
@@ -1483,7 +1483,7 @@ static int rzv2h_cpg_attach_dev(struct generic_pm_domain *domain, struct device
 				goto err;
 			}
 		}
-		clk = of_clk_get_from_provider(&clkspec);
+		clk = dev_clk_get_from_provider(dev, &clkspec);
 		of_node_put(clkspec.np);
 		if (IS_ERR(clk)) {
 			error = PTR_ERR(clk);
Signature · 1 line
2.43.0
Reviewed-by on v1 3/6
#6 lore raw

Re: [PATCH 3/6] clk: renesas: Convert to dev_clk_get_from_provider()

Quoted 4 lines

Renesas clock domain callbacks use of_clk_get_from_provider() to obtain clocks used for power management, so the latter show up as "deviceless" in the consumer column of the clk_summary file in debugfs.

Quoted 8 lines

Fix this by using dev_clk_get_from_provider() instead, letting us pass the consumer device, too.

Sample clk_summary change snippet on R-Car H1 Marzen:
- sata 1 1 0 62500000 0 0 50000 Y deviceless of_clk_get_from_provider
+ sata 1 1 0 62500000 0 0 50000 Y fc600000.sata dev_clk_get_from_provider

Signature · 1 line
Brian Masney <[email protected]>
author maintainer
#7 lore raw

PATCH 4/6 drm/rockchip: dw_hdmi: Convert to dev_clk_get_from_provider()

In reply to Geert Uytterhoeven

The Rockchip Designware HDMI driver uses of_clk_get_from_provider() to obtain the clock for the HDMI PHY, so the latter shows up as "deviceless" in the consumer column of the clk_summary file in debugfs.

Fix this by using dev_clk_get_from_provider() instead, letting us pass the consumer device, too.

---
Compile-tested only.

---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +2 -1
index b6e154c35e7c290e..a44e4b273924430e 100644
@@ -633,7 +633,8 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
 
 		if (!of_parse_phandle_with_args(np, "phys", "#phy-cells", index,
 						&clkspec)) {
-			hdmi->hdmiphy_clk = of_clk_get_from_provider(&clkspec);
+			hdmi->hdmiphy_clk = dev_clk_get_from_provider(dev,
+								      &clkspec);
 			of_node_put(clkspec.np);
 			if (IS_ERR(hdmi->hdmiphy_clk))
 				hdmi->hdmiphy_clk = NULL;
Signature · 1 line
2.43.0
Reviewed-by on v1 4/6
#8 lore raw

Re: [PATCH 4/6] [RFT] drm/rockchip: dw_hdmi: Convert to dev_clk_get_from_provider()

Quoted 8 lines

The Rockchip Designware HDMI driver uses of_clk_get_from_provider() to obtain the clock for the HDMI PHY, so the latter shows up as "deviceless" in the consumer column of the clk_summary file in debugfs.

Fix this by using dev_clk_get_from_provider() instead, letting us pass the consumer device, too.

Signature · 1 line
Brian Masney <[email protected]>
author maintainer
#9 lore raw

PATCH 5/6 ARM: OMAP2+: Convert to dev_clk_get_from_provider()

In reply to Geert Uytterhoeven

OMAP2+ clock handling uses of_clk_get_from_provider() to obtain clocks used for power management, so the latter show up as "deviceless" in the consumer column of the clk_summary file in debugfs.

Fix this by using dev_clk_get_from_provider() instead, letting us pass the consumer device, too.

---
Compile-tested only.

The first change is probably OK. The second change may fail if anything in the oh->od->pdev->dev chain is not available yet at this point.

---
 arch/arm/mach-omap2/omap_device.c | 2 +-
 arch/arm/mach-omap2/omap_hwmod.c  | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/omap_device.c +1 -1
index 77a75b0b9ae69c85..5695e0c8f2392eca 100644
@@ -73,7 +73,7 @@ static void _add_clkdev(struct omap_device *od, const char *clk_alias,
 
 		clkspec.np = of_find_node_by_name(NULL, clk_name);
 
-		r = of_clk_get_from_provider(&clkspec);
+		r = dev_clk_get_from_provider(&od->pdev->dev, &clkspec);
 
 		rc = clk_register_clkdev(r, clk_alias,
 					 dev_name(&od->pdev->dev));
arch/arm/mach-omap2/omap_hwmod.c +2 -1
index 03cd523dff874bb0..5e4123014909d4ac 100644
@@ -147,6 +147,7 @@
 #include <asm/system_misc.h>
 
 #include "clock.h"
+#include "omap_device.h"
 #include "omap_hwmod.h"
 
 #include "soc.h"
@@ -796,7 +797,7 @@ static struct clk *_lookup_clkctrl_clk(struct omap_hwmod *oh)
 				clkspec.args[0] = addr - provider->addr[0];
 				clkspec.args[1] = 0;
 
-				clk = of_clk_get_from_provider(&clkspec);
+				clk = dev_clk_get_from_provider(&oh->od->pdev->dev, &clkspec);
 
 				pr_debug("%s: %s got %p (offset=%x, provider=%pOF)\n",
 					 __func__, oh->name, clk,
Signature · 1 line
2.43.0
maintainer
#10 lore raw

Re: [PATCH 5/6] [RFT] ARM: OMAP2+: Convert to dev_clk_get_from_provider()

Quoted 7 lines · On Thu, 19 Nov 2026 14:40:38 +0100 Geert Uytterhoeven…

OMAP2+ clock handling uses of_clk_get_from_provider() to obtain clocks used for power management, so the latter show up as "deviceless" in the consumer column of the clk_summary file in debugfs.

Fix this by using dev_clk_get_from_provider() instead, letting us pass the consumer device, too.

Quoted 6 lines

---
Compile-tested only.

The first change is probably OK. The second change may fail if anything in the oh->od->pdev->dev chain is not available yet at this point.

Test on OMAP3:

$ diff -u clk-old clk-new
--- clk-old	2026-11-19 22:44:59.810807920 +0100
+++ clk-new	2026-11-19 22:26:52.862531880 +0100
@@ -1,17 +1,17 @@
                                  enable  prepare  protect                                duty  hardware                            connection
    clock                          count    count    count        rate   accuracy phase  cycle    enable   consumer                         id
 ---------------------------------------------------------------------------------------------------------------------------------------------
- oscillator                          0       0        0        26000000    0          0     50000      Y   deviceless                      of_clk_get_from_provider 
+ oscillator                          0       0        0        26000000    0          0     50000      Y   deviceless                      dev_clk_get_from_provider
                                                                                                            deviceless                      no_connection_id         
- secure_32k_fck                      0       1        0        32768       0          0     50000      Y   deviceless                      of_clk_get_from_provider 
+ secure_32k_fck                      0       1        0        32768       0          0     50000      Y   deviceless                      dev_clk_get_from_provider
                                                                                                            deviceless                      no_connection_id         
-    wdt1_fck                         0       0        0        32768       0          0     50000      Y      deviceless                      of_clk_get_from_provider 
+    wdt1_fck                         0       0        0        32768       0          0     50000      Y      deviceless                      dev_clk_get_from_provider
                                                                                                               deviceless                      no_connection_id         
     gpt12_fck                        0       1        0        32768       0          0     50000      Y      48304000.timer                  fck                      
                                                                                                               48304000.target-module          fck                      
-                                                                                                              deviceless                      of_clk_get_from_provider 
+                                                                                                              deviceless                      dev_clk_get_from_provider
                                                                                                               deviceless                      no_connection_id         
- dummy_ck                            0       0        0        0           0          0     50000      Y   deviceless                      of_clk_get_from_provider 
+ dummy_ck                            0       0        0        0           0          0     50000      Y   deviceless                      dev_clk_get_from_provider
                                                                                                            deviceless                      no_connection_id         
  mcbsp_clks                          0       5        0        0           0          0     50000      Y   deviceless                      mcbsp_clks               
                                                                                                            deviceless                      mcbsp_clks               
[...]
Regards,
Andreas
Quoted 39 lines
---
 arch/arm/mach-omap2/omap_device.c | 2 +-
 arch/arm/mach-omap2/omap_hwmod.c  | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/omap_device.c +1 -1
index 77a75b0b9ae69c85..5695e0c8f2392eca 100644
@@ -73,7 +73,7 @@ static void _add_clkdev(struct omap_device *od, const char *clk_alias,
 
 		clkspec.np = of_find_node_by_name(NULL, clk_name);
 
-		r = of_clk_get_from_provider(&clkspec);
+		r = dev_clk_get_from_provider(&od->pdev->dev, &clkspec);
 
 		rc = clk_register_clkdev(r, clk_alias,
 					 dev_name(&od->pdev->dev));
arch/arm/mach-omap2/omap_hwmod.c +2 -1
index 03cd523dff874bb0..5e4123014909d4ac 100644
@@ -147,6 +147,7 @@
 #include <asm/system_misc.h>
 
 #include "clock.h"
+#include "omap_device.h"
 #include "omap_hwmod.h"
 
 #include "soc.h"
@@ -796,7 +797,7 @@ static struct clk *_lookup_clkctrl_clk(struct omap_hwmod *oh)
 				clkspec.args[0] = addr - provider->addr[0];
 				clkspec.args[1] = 0;
 
-				clk = of_clk_get_from_provider(&clkspec);
+				clk = dev_clk_get_from_provider(&oh->od->pdev->dev, &clkspec);
 
 				pr_debug("%s: %s got %p (offset=%x, provider=%pOF)\n",
 					 __func__, oh->name, clk,
Reviewed-by on v1 5/6
#11 lore raw

Re: [PATCH 5/6] [RFT] ARM: OMAP2+: Convert to dev_clk_get_from_provider()

In reply to Geert Uytterhoeven
Quoted 8 lines

OMAP2+ clock handling uses of_clk_get_from_provider() to obtain clocks used for power management, so the latter show up as "deviceless" in the consumer column of the clk_summary file in debugfs.

Fix this by using dev_clk_get_from_provider() instead, letting us pass the consumer device, too.

Signature · 1 line
Brian Masney <[email protected]>
author maintainer
#12 lore raw

RFC PATCH 6/6 pmdomain: renesas: r8a78000: Convert to dev_clk_get_from_provider()

In reply to Geert Uytterhoeven

The R-Car X5H clock domain callback uses of_clk_get_from_provider() to obtain clocks used for power management, so the latter show up as "deviceless" in the consumer column of the clk_summary file in debugfs.

Fix this by using dev_clk_get_from_provider() instead, letting us pass the consumer device, too.

Sample clk_summary change snippet on R-Car X5H Ironhide:
- hscif0 1 1 0 0 0 0 50000 Y deviceless dev_clk_get_from_provider
+ hscif0 1 1 0 0 0 0 50000 Y c0710000.serial dev_clk_get_from_provider

---
This depends on "[PATCH v5 14/15] pmdomain: renesas: r8a78000: Add SCMI remapping support"
https://lore.kernel.org/e6816327da51f9fbeef67f13aac723b891e5042f.1795029012.git.geert+renesas@glider.be/

---
 drivers/pmdomain/renesas/r8a78000-mdlc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pmdomain/renesas/r8a78000-mdlc.c +1 -1
index 79f6f1a9ae95d245..bb8c9f2b68fbf746 100644
@@ -232,7 +232,7 @@ static struct clk *scmi_get_clk(struct device *dev, struct device_node *np,
 	if (fw_id < 0)
 		return NULL;
 
-	clk = of_clk_get_from_provider(&scmi_spec);
+	clk = dev_clk_get_from_provider(dev, &scmi_spec);
 	if (IS_ERR(clk))
 		dev_err(dev, "Cannot get SCMI clock %d: %pe\n", fw_id, clk);
 	else
Signature · 1 line
2.43.0