Re: [GIT PULL] power sequencing updates for v6.11-rc1

From: Manivannan Sadhasivam
Date: Tue Jul 16 2024 - 01:22:14 EST


On Mon, Jul 15, 2024 at 09:29:34PM -0700, Linus Torvalds wrote:
> On Mon, 15 Jul 2024 at 19:17, Linus Torvalds
> <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > Hmm. Let's see how this all works out, but I already found an annoyance.
>
> .. and another one.
>
> On my Altra box, commit 8fb18619d910 ("PCI/pwrctl: Create platform
> devices for child OF nodes of the port node") causes annoying messages
> at bootup:
>
> pci 000c:00:01.0: failed to populate child OF nodes (-22)
> pci 000c:00:02.0: failed to populate child OF nodes (-22)
> .. repeat for every PCI bridge ..
>
> for no obvious reason.
>
> FWIW, -22 is -EINVAL.
>

So we did see these error messages on non-CONFIG_OF platforms, and a fix was
merged as well with commit, 50b040ef3732 ("PCI/pwrctl: only call
of_platform_populate() if CONFIG_OF is enabled")

But apparently, the fix assumed that all CONFIG_OF platforms (selected in
defconfig) have 'dev.of_node' populated. And your platforms being an ARM64 one,
has CONFIG_OF selected ARM64 defconfig, but uses ACPI instead of devicetree. So
you don't have 'dev.of_node', which is a valid configuration btw (we failed to
spot it). And in other places of these of_ APIs, we do have checks for
'dev.of_node'. So for this issue, below diff should be sufficient:

diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index 3bab78cc68f7..abe826bb5840 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -350,7 +350,7 @@ void pci_bus_add_device(struct pci_dev *dev)

pci_dev_assign_added(dev, true);

- if (IS_ENABLED(CONFIG_OF) && pci_is_bridge(dev)) {
+ if (IS_ENABLED(CONFIG_OF) && dev->dev.of_node && pci_is_bridge(dev)) {
retval = of_platform_populate(dev->dev.of_node, NULL, NULL,
&dev->dev);
if (retval)

Let me know if it works, I can spin a patch.

- Mani

--
மணிவண்ணன் சதாசிவம்