Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Bert Karwatzki <spasswolf@web.de>
To: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Cc: Bert Karwatzki <spasswolf@web.de>,
	caleb.connolly@linaro.org, bhelgaas@google.com, brgl@bgdev.pl,
	amit.pundir@linaro.org, neil.armstrong@linaro.org,
	linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org
Subject: [PATCH] pci: bus: only call of_platform_populate() if CONFIG_OF is defined
Date: Wed,  3 Jul 2024 11:15:30 +0200	[thread overview]
Message-ID: <20240703091535.3531-1-spasswolf@web.de> (raw)
In-Reply-To: 20240612082019.19161-4-brgl@bgdev.pl

If of_platform_populate() is called when CONFIG_OF is not defined this
leads to spurious error messages of the following type:
 pci 0000:00:01.1: failed to populate child OF nodes (-19)
 pci 0000:00:02.1: failed to populate child OF nodes (-19)

Fixes: 8fb18619d910 ("PCI/pwrctl: Create platform devices for child OF nodes of the port node")
Signed-off-by: Bert Karwatzki <spasswolf@web.de>
---
 drivers/pci/bus.c | 2 ++
 1 file changed, 2 insertions(+)

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

 	pci_dev_assign_added(dev, true);

+#ifdef CONFIG_OF
 	if (pci_is_bridge(dev)) {
 		retval = of_platform_populate(dev->dev.of_node, NULL, NULL,
 					      &dev->dev);
@@ -357,6 +358,7 @@ void pci_bus_add_device(struct pci_dev *dev)
 			pci_err(dev, "failed to populate child OF nodes (%d)\n",
 				retval);
 	}
+#endif
 }
 EXPORT_SYMBOL_GPL(pci_bus_add_device);

--
2.45.2

The mentioned error message occur on systems without CONFIG_OF, i.e.
x86_64. The call to of_platform_depopulate() in drivers/pci/remove.c
does not need #ifdef CONFIG_OF as the return value is not checked (it
will most likely be optimized away on platforms witout OF where the
of_platform_{de,}populate() functions just return -ENODEV)

Please CC me when replying, I'm not subscribed to the lists.

Bert Karwatzki

             reply	other threads:[~2024-07-03  9:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-03  9:15 Bert Karwatzki [this message]
2024-07-03  9:32 ` [PATCH] pci: bus: only call of_platform_populate() if CONFIG_OF is defined Bartosz Golaszewski
2024-07-06  8:42   ` Lukas Wunner
2024-07-06 17:12     ` Bartosz Golaszewski
2024-07-07 13:31       ` Lukas Wunner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240703091535.3531-1-spasswolf@web.de \
    --to=spasswolf@web.de \
    --cc=amit.pundir@linaro.org \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=bhelgaas@google.com \
    --cc=brgl@bgdev.pl \
    --cc=caleb.connolly@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=neil.armstrong@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox