From: Lukas Wunner <lukas@wunner.de>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Bert Karwatzki <spasswolf@web.de>,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
caleb.connolly@linaro.org, bhelgaas@google.com,
amit.pundir@linaro.org, neil.armstrong@linaro.org,
linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH] pci: bus: only call of_platform_populate() if CONFIG_OF is defined
Date: Sun, 7 Jul 2024 15:31:59 +0200 [thread overview]
Message-ID: <ZoqYz-MWD06GmKPJ@wunner.de> (raw)
In-Reply-To: <CAMRc=McBpqP=qSbxDGcreTcktq_0vQH_PrtQS0V=Mw3w-_Zmwg@mail.gmail.com>
On Sat, Jul 06, 2024 at 07:12:48PM +0200, Bartosz Golaszewski wrote:
> On Sat, Jul 6, 2024 at 10:43???AM Lukas Wunner <lukas@wunner.de> wrote:
> > On Wed, Jul 03, 2024 at 11:32:05AM +0200, Bartosz Golaszewski wrote:
> > > On Wed, Jul 3, 2024 at 11:15 AM Bert Karwatzki <spasswolf@web.de> wrote:
> > > > 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)
[...]
> > > > --- 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)) {
> > >
> > > There's a better (less ifdeffery) fix on the list that I'll pick up
> > > later today[1].
> > >
> > > [1] https://lore.kernel.org/lkml/20240702180839.71491-1-superm1@kernel.org/T/
> >
> > That other fix doesn't feel very robust as it depends on
> > of_platform_populate() never returning -ENODEV in the
> > CONFIG_OF=y case.
>
> If we even have to play these ifdef games then the stubs for
> of_platform_populate() are broken and should probably return 0 with
> !OF as otherwise the stubs themselves are useless.
The stub was introduced by commit 964dba283439 ("devicetree: Add empty
of_platform_populate() for !CONFIG_OF_ADDRESS (sparc)") some twelve
years ago.
From a brief look I'm under the impression that the commit used -ENODEV
on purpose (instead of 0).
There are 100 files in the kernel source tree referencing
of_platform_populate(). The majority is probably not compiled
in the CONFIG_OF=n case, nevertheless changing the stub risks
regressing some of those 100 callers unless great care is
observed.
Just making this conditional on IS_ENABLED(CONFIG_OF) is the
least risky option.
Thanks,
Lukas
prev parent reply other threads:[~2024-07-07 13:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-03 9:15 [PATCH] pci: bus: only call of_platform_populate() if CONFIG_OF is defined Bert Karwatzki
2024-07-03 9:32 ` Bartosz Golaszewski
2024-07-06 8:42 ` Lukas Wunner
2024-07-06 17:12 ` Bartosz Golaszewski
2024-07-07 13:31 ` Lukas Wunner [this message]
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=ZoqYz-MWD06GmKPJ@wunner.de \
--to=lukas@wunner.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 \
--cc=spasswolf@web.de \
/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