From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
Johan Hovold <johan+linaro@kernel.org>,
Abel Vesa <abel.vesa@linaro.org>,
Stephan Gerhold <stephan.gerhold@linaro.org>,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Subject: Re: [PATCH 1/5] PCI/pwrctl: Use of_platform_device_create() to create pwrctl devices
Date: Thu, 24 Oct 2024 19:07:34 +0530 [thread overview]
Message-ID: <20241024133734.7iibqvjby3id4hjt@thinkpad> (raw)
In-Reply-To: <CACMJSeuBb9VmRrGJnak6D3Ddow+-OMb+79uZzUUaWe3BF1SgTg@mail.gmail.com>
On Wed, Oct 23, 2024 at 11:18:51AM +0200, Bartosz Golaszewski wrote:
> On Tue, 22 Oct 2024 at 12:28, Manivannan Sadhasivam via B4 Relay
> <devnull+manivannan.sadhasivam.linaro.org@kernel.org> wrote:
> >
> > From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> >
> > of_platform_populate() API creates platform devices by descending through
> > the children of the parent node. But it provides no control over the child
> > nodes, which makes it difficult to add checks for the child nodes in the
> > future. So use of_platform_device_create() API together with
> > for_each_child_of_node_scoped() so that it is possible to add checks for
> > each node before creating the platform device.
> >
> > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> > ---
> > drivers/pci/bus.c | 12 +++++++-----
> > 1 file changed, 7 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
> > index 55c853686051..959044b059b5 100644
> > --- a/drivers/pci/bus.c
> > +++ b/drivers/pci/bus.c
> > @@ -13,6 +13,7 @@
> > #include <linux/ioport.h>
> > #include <linux/of.h>
> > #include <linux/of_platform.h>
> > +#include <linux/platform_device.h>
> > #include <linux/proc_fs.h>
> > #include <linux/slab.h>
> >
> > @@ -329,6 +330,7 @@ void __weak pcibios_bus_add_device(struct pci_dev *pdev) { }
> > void pci_bus_add_device(struct pci_dev *dev)
> > {
> > struct device_node *dn = dev->dev.of_node;
> > + struct platform_device *pdev;
> > int retval;
> >
> > /*
> > @@ -351,11 +353,11 @@ void pci_bus_add_device(struct pci_dev *dev)
> > pci_dev_assign_added(dev, true);
> >
> > if (dev_of_node(&dev->dev) && pci_is_bridge(dev)) {
> > - retval = of_platform_populate(dev_of_node(&dev->dev), NULL, NULL,
> > - &dev->dev);
> > - if (retval)
> > - pci_err(dev, "failed to populate child OF nodes (%d)\n",
> > - retval);
> > + for_each_child_of_node_scoped(dn, child) {
>
> Since we won't be populating any disabled nodes, I'd use
> for_each_available_child_of_node_scoped() here.
>
Ack.
- Mani
--
மணிவண்ணன் சதாசிவம்
next prev parent reply other threads:[~2024-10-24 13:37 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-22 10:27 [PATCH 0/5] PCI/pwrctl: Ensure that the pwrctl drivers are probed before PCI client drivers Manivannan Sadhasivam
2024-10-22 10:27 ` Manivannan Sadhasivam via B4 Relay
2024-10-22 10:27 ` [PATCH 1/5] PCI/pwrctl: Use of_platform_device_create() to create pwrctl devices Manivannan Sadhasivam
2024-10-22 10:27 ` Manivannan Sadhasivam via B4 Relay
2024-10-23 9:18 ` Bartosz Golaszewski
2024-10-24 13:37 ` Manivannan Sadhasivam [this message]
2024-10-22 10:27 ` [PATCH 2/5] PCI/pwrctl: Create pwrctl devices only if at least one power supply is present Manivannan Sadhasivam
2024-10-22 10:27 ` Manivannan Sadhasivam via B4 Relay
2024-10-23 9:22 ` Bartosz Golaszewski
2024-10-22 10:27 ` [PATCH 3/5] PCI/pwrctl: Ensure that the pwrctl drivers are probed before the PCI client drivers Manivannan Sadhasivam
2024-10-22 10:27 ` Manivannan Sadhasivam via B4 Relay
2024-10-23 10:22 ` Bartosz Golaszewski
2024-10-22 10:27 ` [PATCH 4/5] PCI/pwrctl: Move pwrctl device creation to its own helper function Manivannan Sadhasivam
2024-10-22 10:27 ` Manivannan Sadhasivam via B4 Relay
2024-10-23 10:23 ` Bartosz Golaszewski
2024-10-25 8:04 ` Manivannan Sadhasivam
2024-10-25 8:06 ` Bartosz Golaszewski
2024-10-22 10:27 ` [PATCH 5/5] PCI/pwrctl: Remove pwrctl device without iterating over all children of pwrctl parent Manivannan Sadhasivam
2024-10-22 10:27 ` Manivannan Sadhasivam via B4 Relay
2024-10-23 10:25 ` Bartosz Golaszewski
2024-10-23 10:30 ` [PATCH 0/5] PCI/pwrctl: Ensure that the pwrctl drivers are probed before PCI client drivers Bartosz Golaszewski
2024-10-24 10:13 ` Krishna Chaitanya Chundru
2024-11-03 20:31 ` Krzysztof Wilczyński
2024-11-05 0:12 ` Bjorn Helgaas
2024-11-05 0:32 ` Krzysztof Wilczyński
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=20241024133734.7iibqvjby3id4hjt@thinkpad \
--to=manivannan.sadhasivam@linaro.org \
--cc=abel.vesa@linaro.org \
--cc=bartosz.golaszewski@linaro.org \
--cc=bhelgaas@google.com \
--cc=bjorn.andersson@oss.qualcomm.com \
--cc=dmitry.baryshkov@linaro.org \
--cc=johan+linaro@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=srinivas.kandagatla@linaro.org \
--cc=stephan.gerhold@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 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.