Re: [PATCH v2 2/5] PCI/pwrctl: Create pwrctl devices only if at least one power supply is present

From: Manivannan Sadhasivam
Date: Thu Nov 07 2024 - 06:16:59 EST


On Thu, Nov 07, 2024 at 10:52:35AM +0100, Bartosz Golaszewski wrote:
> On Wed, Nov 6, 2024 at 10:28 PM Bjorn Helgaas <helgaas@xxxxxxxxxx> wrote:
> >
> > On Fri, Oct 25, 2024 at 01:24:52PM +0530, Manivannan Sadhasivam via B4 Relay wrote:
> > > From: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx>
> > >
> > > Currently, pwrctl devices are created if the corresponding PCI nodes are
> > > defined in devicetree. But this is not correct, because not all PCI nodes
> > > defined in devicetree require pwrctl support. Pwrctl comes into picture
> > > only when the device requires kernel to manage its power state. This can
> > > be determined using the power supply properties present in the devicetree
> > > node of the device.
> >
> > > +bool of_pci_is_supply_present(struct device_node *np)
> > > +{
> > > + struct property *prop;
> > > + char *supply;
> > > +
> > > + if (!np)
> > > + return false;
> >
> > Why do we need to test !np here? It should always be non-NULL.
> >
>
> Right, I think this can be dropped. We check for the OF node in the
> function above.
>

I think it was a leftover that I didn't cleanup. But I do plan to move this API
to drivers/of once 6.13-rc1 is out. So even if it didn't get dropped now, I will
do it later.

- Mani

--
மணிவண்ணன் சதாசிவம்