Re: [PATCH v3] PCI/pwrctrl: Move pci_pwrctrl_create_device() definition to drivers/pci/pwrctrl/

From: Lukas Wunner
Date: Mon Jun 16 2025 - 09:19:55 EST


On Mon, Jun 16, 2025 at 06:07:48PM +0530, Manivannan Sadhasivam wrote:
> On Mon, Jun 16, 2025 at 08:21:20PM +0800, kernel test robot wrote:
> > ld: drivers/pci/probe.o: in function `pci_scan_single_device':
> > >> probe.c:(.text+0x2400): undefined reference to `pci_pwrctrl_create_device'
>
> Hmm, so we cannot have a built-in driver depend on a module...
>
> Bartosz, should we make CONFIG_PCI_PWRCTRL bool then? We can still allow the
> individual pwrctrl drivers be tristate.

I guess the alternative is to just leave it in probe.c. The function is
optimized away in the CONFIG_OF=n case because of_pci_find_child_device()
returns NULL. It's unpleasant that it lives outside of pwrctrl/core.c,
but it doesn't occupy any space in the compiled kernel at least on non-OF
(e.g. ACPI) platforms.

Thanks,

Lukas