[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <znlxzmn74mclx6n3gjz2oordgauygsu5jqs33kc5k34j34b5iq@ntjjj4v7pbpu>
Date: Thu, 6 Nov 2025 17:22:52 +0530
From: Manivannan Sadhasivam <mani@...nel.org>
To: Konrad Dybcio <konrad.dybcio@....qualcomm.com>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@....qualcomm.com>,
lpieralisi@...nel.org, kwilczynski@...nel.org, bhelgaas@...gle.com, will@...nel.org,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org, robh@...nel.org,
linux-arm-msm@...r.kernel.org, zhangsenchuan@...incomputing.com
Subject: Re: [PATCH 1/3] PCI: host-common: Add an API to check for any device
under the Root Ports
On Thu, Nov 06, 2025 at 10:47:48AM +0100, Konrad Dybcio wrote:
> On 11/6/25 7:13 AM, Manivannan Sadhasivam wrote:
> > Some controller drivers need to check if there is any device available
> > under the Root Ports. So add an API that returns 'true' if a device is
> > found under any of the Root Ports, 'false' otherwise.
> >
> > Controller drivers can use this API for usecases like turning off the
> > controller resources only if there are no devices under the Root Ports,
> > skipping PME_Turn_Off broadcast etc...
> >
> > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@....qualcomm.com>
> > ---
> > drivers/pci/controller/pci-host-common.c | 21 +++++++++++++++++++++
> > drivers/pci/controller/pci-host-common.h | 2 ++
> > 2 files changed, 23 insertions(+)
> >
> > diff --git a/drivers/pci/controller/pci-host-common.c b/drivers/pci/controller/pci-host-common.c
> > index 810d1c8de24e..6b4f90903dc6 100644
> > --- a/drivers/pci/controller/pci-host-common.c
> > +++ b/drivers/pci/controller/pci-host-common.c
> > @@ -17,6 +17,27 @@
> >
> > #include "pci-host-common.h"
> >
> > +/**
> > + * pci_root_ports_have_device - Check if the Root Ports under the Root bus have
> > + * any device underneath
> > + * @dev: Root bus
> > + *
> > + * Return: true if a device is found, false otherwise
> > + */
> > +bool pci_root_ports_have_device(struct pci_bus *root_bus)
> > +{
> > + struct pci_bus *child;
> > +
> > + /* Iterate over the Root Port busses and look for any device */
> > + list_for_each_entry(child, &root_bus->children, node) {
> > + if (list_count_nodes(&child->devices))
>
> Is this list ever shrunk? I grepped around and couldn't find where
> that happens
>
So I digged into this and other 'pci_bus' lists, to my shock, none of list
entries were getting dropped. I'll send out fixes for all of them.
Thanks for catching this historical issue that no one noticed before :)
- Mani
--
மணிவண்ணன் சதாசிவம்
Powered by blists - more mailing lists