All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 2/2] clk: Search clocks of ACPI device with its companion device
  2026-11-30 12:28 [PATCH v6 0/2] ACPI: Add ACPI 6.5 fixed clock support Paul Cercueil
@ 2026-11-30 12:28 ` Paul Cercueil
  2026-11-30 16:44   ` kernel test robot
  2026-11-30 17:15   ` kernel test robot
  0 siblings, 2 replies; 4+ messages in thread
From: Paul Cercueil @ 2026-11-30 12:28 UTC (permalink / raw)
  To: Rafael J . Wysocki, Len Brown, Russell King,
	Maciej Wieczor-Retman, Pawel Chmielewski
  Cc: linux-acpi, linux-arm-kernel, acpica-devel, linux-kernel,
	Thomas Petazzoni, Paul Cercueil

If the device passed as argument to clk_get() has a companion ACPI
device, use it to search the clocks. If we can't find our clock there,
fall back to the regular path.

The argument for this, is that ACPI clocks are registered to clkdev
using the companion ACPI device's name, before the regular device object
is created.

Signed-off-by: Paul Cercueil <paul.cercueil@bootlin.com>
---

v6: New patch
---
 drivers/clk/clkdev.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
index 919fc680ae4d..396715f30ff0 100644
--- a/drivers/clk/clkdev.c
+++ b/drivers/clk/clkdev.c
@@ -6,6 +6,7 @@
  *
  * Helper for the clk API to assist looking up a struct clk.
  */
+#include <linux/acpi.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/device.h>
@@ -100,7 +101,9 @@ EXPORT_SYMBOL(clk_get_sys);
 struct clk *clk_get(struct device *dev, const char *con_id)
 {
 	const char *dev_id = dev ? dev_name(dev) : NULL;
+	struct acpi_device *adev;
 	struct clk_hw *hw;
+	struct clk *clk;
 
 	if (dev && dev->of_node) {
 		hw = of_clk_get_hw(dev->of_node, 0, con_id);
@@ -108,6 +111,13 @@ struct clk *clk_get(struct device *dev, const char *con_id)
 			return clk_hw_create_clk(dev, hw, dev_id, con_id, NULL);
 	}
 
+	if (dev && has_acpi_companion(dev)) {
+		adev = ACPI_COMPANION(dev);
+		clk = clk_get(&adev->dev, con_id);
+		if (!IS_ERR(clk) || PTR_ERR(clk) != -ENOENT)
+			return clk;
+	}
+
 	return __clk_get_sys(dev, dev_id, con_id);
 }
 EXPORT_SYMBOL(clk_get);
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v6 2/2] clk: Search clocks of ACPI device with its companion device
  2026-11-30 12:28 ` [PATCH v6 2/2] clk: Search clocks of ACPI device with its companion device Paul Cercueil
@ 2026-11-30 16:44   ` kernel test robot
  2026-11-30 17:15   ` kernel test robot
  1 sibling, 0 replies; 4+ messages in thread
From: kernel test robot @ 2026-11-30 16:44 UTC (permalink / raw)
  To: Paul Cercueil, Rafael J . Wysocki, Len Brown, Russell King,
	Maciej Wieczor-Retman, Pawel Chmielewski
  Cc: llvm, oe-kbuild-all, linux-acpi, linux-arm-kernel, acpica-devel,
	linux-kernel, Thomas Petazzoni, Paul Cercueil

Hi Paul,

kernel test robot noticed the following build errors:

[auto build test ERROR on rafael-pm/linux-next]
[also build test ERROR on rafael-pm/bleeding-edge linus/master v7.4-rc5 next-20261127]
[cannot apply to arm/for-next arm/fixes rmk-arm/clkdev]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Paul-Cercueil/ACPI-Add-basic-support-for-ACPI-6-5-fixed-clock-resources/20261130-132826
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link:    https://lore.kernel.org/r/20261130122827.157946-3-paul.cercueil%40bootlin.com
patch subject: [PATCH v6 2/2] clk: Search clocks of ACPI device with its companion device
config: arm-allnoconfig (https://download.01.org/0day-ci/archive/20261201/20261201003418.VGtmNGd5-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261201/20261201003418.VGtmNGd5-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/20261201003418.VGtmNGd5-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/clk/clkdev.c:116:22: error: incomplete definition of type 'struct acpi_device'
     116 |                 clk = clk_get(&adev->dev, con_id);
         |                                ~~~~^
   include/linux/device/bus.h:222:8: note: forward declaration of 'struct acpi_device'
     222 | struct acpi_device;
         |        ^
   1 error generated.


vim +116 drivers/clk/clkdev.c

   100	
   101	struct clk *clk_get(struct device *dev, const char *con_id)
   102	{
   103		const char *dev_id = dev ? dev_name(dev) : NULL;
   104		struct acpi_device *adev;
   105		struct clk_hw *hw;
   106		struct clk *clk;
   107	
   108		if (dev && dev->of_node) {
   109			hw = of_clk_get_hw(dev->of_node, 0, con_id);
   110			if (!IS_ERR(hw) || PTR_ERR(hw) == -EPROBE_DEFER)
   111				return clk_hw_create_clk(dev, hw, dev_id, con_id, NULL);
   112		}
   113	
   114		if (dev && has_acpi_companion(dev)) {
   115			adev = ACPI_COMPANION(dev);
 > 116			clk = clk_get(&adev->dev, con_id);
   117			if (!IS_ERR(clk) || PTR_ERR(clk) != -ENOENT)
   118				return clk;
   119		}
   120	
   121		return __clk_get_sys(dev, dev_id, con_id);
   122	}
   123	EXPORT_SYMBOL(clk_get);
   124	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v6 2/2] clk: Search clocks of ACPI device with its companion device
  2026-11-30 12:28 ` [PATCH v6 2/2] clk: Search clocks of ACPI device with its companion device Paul Cercueil
  2026-11-30 16:44   ` kernel test robot
@ 2026-11-30 17:15   ` kernel test robot
  1 sibling, 0 replies; 4+ messages in thread
From: kernel test robot @ 2026-11-30 17:15 UTC (permalink / raw)
  To: Paul Cercueil, Rafael J . Wysocki, Len Brown, Russell King,
	Maciej Wieczor-Retman, Pawel Chmielewski
  Cc: oe-kbuild-all, linux-acpi, linux-arm-kernel, acpica-devel,
	linux-kernel, Thomas Petazzoni, Paul Cercueil

Hi Paul,

kernel test robot noticed the following build errors:

[auto build test ERROR on rafael-pm/linux-next]
[also build test ERROR on rafael-pm/bleeding-edge linus/master v7.4-rc5 next-20261127]
[cannot apply to arm/for-next arm/fixes rmk-arm/clkdev]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Paul-Cercueil/ACPI-Add-basic-support-for-ACPI-6-5-fixed-clock-resources/20261130-132826
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link:    https://lore.kernel.org/r/20261130122827.157946-3-paul.cercueil%40bootlin.com
patch subject: [PATCH v6 2/2] clk: Search clocks of ACPI device with its companion device
config: nios2-defconfig (https://download.01.org/0day-ci/archive/20261201/20261201011220.DsUj74jS-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 11.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261201/20261201011220.DsUj74jS-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/20261201011220.DsUj74jS-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/clk/clkdev.c: In function 'clk_get':
>> drivers/clk/clkdev.c:116:36: error: invalid use of undefined type 'struct acpi_device'
     116 |                 clk = clk_get(&adev->dev, con_id);
         |                                    ^~


vim +116 drivers/clk/clkdev.c

   100	
   101	struct clk *clk_get(struct device *dev, const char *con_id)
   102	{
   103		const char *dev_id = dev ? dev_name(dev) : NULL;
   104		struct acpi_device *adev;
   105		struct clk_hw *hw;
   106		struct clk *clk;
   107	
   108		if (dev && dev->of_node) {
   109			hw = of_clk_get_hw(dev->of_node, 0, con_id);
   110			if (!IS_ERR(hw) || PTR_ERR(hw) == -EPROBE_DEFER)
   111				return clk_hw_create_clk(dev, hw, dev_id, con_id, NULL);
   112		}
   113	
   114		if (dev && has_acpi_companion(dev)) {
   115			adev = ACPI_COMPANION(dev);
 > 116			clk = clk_get(&adev->dev, con_id);
   117			if (!IS_ERR(clk) || PTR_ERR(clk) != -ENOENT)
   118				return clk;
   119		}
   120	
   121		return __clk_get_sys(dev, dev_id, con_id);
   122	}
   123	EXPORT_SYMBOL(clk_get);
   124	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v6 2/2] clk: Search clocks of ACPI device with its companion device
@ 2026-11-30 18:19 kernel test robot
  0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2026-11-30 18:19 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "too many reports for this commit"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20261130122827.157946-3-paul.cercueil@bootlin.com>
References: <20261130122827.157946-3-paul.cercueil@bootlin.com>
TO: Paul Cercueil <paul.cercueil@bootlin.com>
TO: "Rafael J . Wysocki" <rafael@kernel.org>
TO: Len Brown <lenb@kernel.org>
TO: Russell King <linux@armlinux.org.uk>
TO: "Maciej Wieczor-Retman" <maciej.wieczor-retman@intel.com>
TO: Pawel Chmielewski <pawel.chmielewski@intel.com>
CC: linux-acpi@vger.kernel.org
CC: linux-arm-kernel@lists.infradead.org
CC: acpica-devel@lists.linux.dev
CC: linux-kernel@vger.kernel.org
CC: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
CC: Paul Cercueil <paul.cercueil@bootlin.com>

Hi Paul,

kernel test robot noticed the following build errors:

[auto build test ERROR on rafael-pm/linux-next]
[also build test ERROR on rafael-pm/bleeding-edge linus/master v7.4-rc5 next-20261127]
[cannot apply to arm/for-next arm/fixes rmk-arm/clkdev]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Paul-Cercueil/ACPI-Add-basic-support-for-ACPI-6-5-fixed-clock-resources/20261130-132826
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link:    https://lore.kernel.org/r/20261130122827.157946-3-paul.cercueil%40bootlin.com
patch subject: [PATCH v6 2/2] clk: Search clocks of ACPI device with its companion device
:::::: branch date: 6 hours ago
:::::: commit date: 6 hours ago
config: xtensa-randconfig-1000-20261130 (https://download.01.org/0day-ci/archive/20261201/20261201021503.NmZo7brJ-lkp@intel.com/config)
compiler: xtensa-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261201/20261201021503.NmZo7brJ-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/r/20261201021503.NmZo7brJ-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/clk/clkdev.c: In function 'clk_get':
>> drivers/clk/clkdev.c:116:22: error: dereferencing pointer to incomplete type 'struct acpi_device'
      clk = clk_get(&adev->dev, con_id);
                         ^~


vim +116 drivers/clk/clkdev.c

05fd8e73e1357f arch/arm/common/clkdev.c Sascha Hauer        2009-03-07  100  
05fd8e73e1357f arch/arm/common/clkdev.c Sascha Hauer        2009-03-07  101  struct clk *clk_get(struct device *dev, const char *con_id)
05fd8e73e1357f arch/arm/common/clkdev.c Sascha Hauer        2009-03-07  102  {
05fd8e73e1357f arch/arm/common/clkdev.c Sascha Hauer        2009-03-07  103  	const char *dev_id = dev ? dev_name(dev) : NULL;
53ea89e5ed06ee drivers/clk/clkdev.c     Paul Cercueil       2026-11-30  104  	struct acpi_device *adev;
4472287a3b2f52 drivers/clk/clkdev.c     Stephen Boyd        2018-12-19  105  	struct clk_hw *hw;
53ea89e5ed06ee drivers/clk/clkdev.c     Paul Cercueil       2026-11-30  106  	struct clk *clk;
766e6a4ec602d0 drivers/clk/clkdev.c     Grant Likely        2012-04-09  107  
53ccb22b8d4a92 drivers/clk/clkdev.c     Bartosz Golaszewski 2018-06-28  108  	if (dev && dev->of_node) {
4472287a3b2f52 drivers/clk/clkdev.c     Stephen Boyd        2018-12-19  109  		hw = of_clk_get_hw(dev->of_node, 0, con_id);
4472287a3b2f52 drivers/clk/clkdev.c     Stephen Boyd        2018-12-19  110  		if (!IS_ERR(hw) || PTR_ERR(hw) == -EPROBE_DEFER)
a1c8d531c694e1 drivers/clk/clkdev.c     Jerome Brunet       2026-07-23  111  			return clk_hw_create_clk(dev, hw, dev_id, con_id, NULL);
766e6a4ec602d0 drivers/clk/clkdev.c     Grant Likely        2012-04-09  112  	}
05fd8e73e1357f arch/arm/common/clkdev.c Sascha Hauer        2009-03-07  113  
53ea89e5ed06ee drivers/clk/clkdev.c     Paul Cercueil       2026-11-30  114  	if (dev && has_acpi_companion(dev)) {
53ea89e5ed06ee drivers/clk/clkdev.c     Paul Cercueil       2026-11-30  115  		adev = ACPI_COMPANION(dev);
53ea89e5ed06ee drivers/clk/clkdev.c     Paul Cercueil       2026-11-30 @116  		clk = clk_get(&adev->dev, con_id);
53ea89e5ed06ee drivers/clk/clkdev.c     Paul Cercueil       2026-11-30  117  		if (!IS_ERR(clk) || PTR_ERR(clk) != -ENOENT)
53ea89e5ed06ee drivers/clk/clkdev.c     Paul Cercueil       2026-11-30  118  			return clk;
53ea89e5ed06ee drivers/clk/clkdev.c     Paul Cercueil       2026-11-30  119  	}
53ea89e5ed06ee drivers/clk/clkdev.c     Paul Cercueil       2026-11-30  120  
efa850487a6b67 drivers/clk/clkdev.c     Stephen Boyd        2018-12-11  121  	return __clk_get_sys(dev, dev_id, con_id);
05fd8e73e1357f arch/arm/common/clkdev.c Sascha Hauer        2009-03-07  122  }
0318e693d3a568 arch/arm/common/clkdev.c Russell King        2008-11-09  123  EXPORT_SYMBOL(clk_get);
0318e693d3a568 arch/arm/common/clkdev.c Russell King        2008-11-09  124  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-30 18:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 18:19 [PATCH v6 2/2] clk: Search clocks of ACPI device with its companion device kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2026-11-30 12:28 [PATCH v6 0/2] ACPI: Add ACPI 6.5 fixed clock support Paul Cercueil
2026-11-30 12:28 ` [PATCH v6 2/2] clk: Search clocks of ACPI device with its companion device Paul Cercueil
2026-11-30 16:44   ` kernel test robot
2026-11-30 17:15   ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.