[PATCH V8 03/13] PCI: dwc: Parse Root Port nodes in dw_pcie_host_init()
Manivannan Sadhasivam
mani at kernel.org
Tue Mar 17 02:58:18 PDT 2026
On Tue, Mar 17, 2026 at 09:04:51AM +0000, Sherry Sun wrote:
> > Subject: Re: [PATCH V8 03/13] PCI: dwc: Parse Root Port nodes in
> > dw_pcie_host_init()
> >
> > On Fri, Mar 13, 2026 at 10:08:13AM +0800, Sherry Sun wrote:
> > > Add support for parsing Root Port child nodes in dw_pcie_host_init()
> > > using pci_host_common_parse_ports(). This allows DWC-based drivers to
> > > specify Root Port properties (like reset GPIOs) in individual Root
> > > Port nodes rather than in the host bridge node.
> > >
> > > Signed-off-by: Sherry Sun <sherry.sun at nxp.com>
> > > ---
> > > drivers/pci/controller/dwc/pcie-designware-host.c | 8 ++++++++
> > > 1 file changed, 8 insertions(+)
> > >
> > > diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c
> > > b/drivers/pci/controller/dwc/pcie-designware-host.c
> > > index a74339982c24..9608f9fcd1b3 100644
> > > --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> > > +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> > > @@ -20,6 +20,7 @@
> > > #include <linux/platform_device.h>
> > >
> > > #include "../../pci.h"
> > > +#include "../pci-host-common.h"
> > > #include "pcie-designware.h"
> > >
> > > static struct pci_ops dw_pcie_ops;
> > > @@ -581,6 +582,13 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)
> > >
> > > pp->bridge = bridge;
> > >
> > > + /* Parse Root Port nodes if present */
> > > + ret = pci_host_common_parse_ports(dev, bridge);
> > > + if (ret && ret != -ENOENT) {
> >
> > Is there an incentive in the -ENOENT error code? Should the API just return 0
> > if no ports are found?
> >
>
> Hi Mani,
>
> Since devm_fwnode_gpiod_get() is called within pci_host_common_parse_ports(),
> devm_fwnode_gpiod_get() will return -ENOENT if no GPIO found. That means we
> need to check and handle the -ENOENT error anyway, we can either handle it internally
> in pci_host_common_parse_ports() or in the upper caller.
>
> If we hide -ENOENT inside pci_host_common_parse_ports() and always return 0, we
> lose this distinction, the caller can no longer tell the difference between "not found" and
> "found and parsed successfully". This might be useful that different callers might want to
> handle differently.
>
> The current pattern is also consistent with some other optional resource APIs in the
> kernel (e.g., devm_regulator_get_optional()), where -ENOENT is returned and the caller
> decides how to handle it.
>
Sure. But since the current callers are not making use of it, I thought of just
returning 0. It fine with me to leave it as is.
- Mani
--
மணிவண்ணன் சதாசிவம்
More information about the linux-arm-kernel
mailing list