public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Lukas Wunner <lukas@wunner.de>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Qiang Yu <quic_qianyu@quicinc.com>
Subject: Re: [PATCH 1/4] PCI/pwrctrl: Move creation of pwrctrl devices to pci_scan_device()
Date: Mon, 16 Dec 2024 10:45:21 +0530	[thread overview]
Message-ID: <20241216051521.riyy5radru6rxqhg@thinkpad> (raw)
In-Reply-To: <Z18Pmq7_rK3pvuT4@wunner.de>

On Sun, Dec 15, 2024 at 06:19:22PM +0100, Lukas Wunner wrote:
> On Tue, Dec 10, 2024 at 03:25:24PM +0530, Manivannan Sadhasivam via B4 Relay wrote:
> > --- a/drivers/pci/probe.c
> > +++ b/drivers/pci/probe.c
> > @@ -2446,6 +2448,36 @@ bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l,
> >  }
> >  EXPORT_SYMBOL(pci_bus_read_dev_vendor_id);
> >  
> > +/*
> > + * Create pwrctrl devices (if required) for the PCI devices to handle the power
> > + * state.
> > + */
> > +static void pci_pwrctrl_create_devices(struct pci_bus *bus, int devfn)
> 
> Nit:  AFAICS this only creates a *single* platform device, so the
> "devices" (plural) in the function name and in the code comment
> doesn't seem to be accurate anymore.
> 

I missed it, thanks for pointing out.

> 
> > diff --git a/drivers/pci/pwrctrl/core.c b/drivers/pci/pwrctrl/core.c
> > index 2fb174db91e5..9cc7e2b7f2b5 100644
> > --- a/drivers/pci/pwrctrl/core.c
> > +++ b/drivers/pci/pwrctrl/core.c
> > @@ -44,7 +44,7 @@ static void rescan_work_func(struct work_struct *work)
> >  						   struct pci_pwrctrl, work);
> >  
> >  	pci_lock_rescan_remove();
> > -	pci_rescan_bus(to_pci_dev(pwrctrl->dev->parent)->bus);
> > +	pci_rescan_bus(to_pci_host_bridge(pwrctrl->dev->parent)->bus);
> >  	pci_unlock_rescan_remove();
> >  }
> 
> Remind me, what's the purpose of this?  I'm guessing that it
> recursively creates the platform devices below the newly
> powered up device, is that correct?  If so, is it still
> necessary?  Doesn't the new approach automatically create
> those devices upon their enumeration?
> 

If the pwrctrl driver is available at the time of platform device creation, this
is not needed. But if the driver is not available at that time and probed
later, then we need to rescan the bus to enumerate the devices. This is pretty
much needed for platforms lacking hotplug support (most of the DT ones).

> Overall it looks like a significant improvement, thanks for doing this!
> 

Thanks a lot for your inputs too!

- Mani

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

  reply	other threads:[~2024-12-16  5:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-10  9:55 [PATCH 0/4] PCI/pwrctrl: Rework pwrctrl driver integration and add driver for PCI slot Manivannan Sadhasivam via B4 Relay
2024-12-10  9:55 ` [PATCH 1/4] PCI/pwrctrl: Move creation of pwrctrl devices to pci_scan_device() Manivannan Sadhasivam via B4 Relay
2024-12-15 17:19   ` Lukas Wunner
2024-12-16  5:15     ` Manivannan Sadhasivam [this message]
2024-12-17 13:14       ` Lukas Wunner
2024-12-17 14:50         ` Manivannan Sadhasivam
2024-12-10  9:55 ` [PATCH 2/4] PCI/pwrctrl: Move pci_pwrctrl_unregister() to pci_destroy_dev() Manivannan Sadhasivam via B4 Relay
2024-12-15 17:20   ` Lukas Wunner
2024-12-10  9:55 ` [PATCH 3/4] dt-bindings: vendor-prefixes: Document the 'pciclass' prefix Manivannan Sadhasivam via B4 Relay
2024-12-17 13:34   ` Rob Herring (Arm)
2024-12-10  9:55 ` [PATCH 4/4] PCI/pwrctrl: Add pwrctrl driver for PCI Slots Manivannan Sadhasivam via B4 Relay
2024-12-18  9:16   ` kernel test robot
2024-12-10 12:40 ` [PATCH 0/4] PCI/pwrctrl: Rework pwrctrl driver integration and add driver for PCI slot Bartosz Golaszewski
2024-12-11  9:55 ` Qiang Yu
2024-12-15 17:32   ` Lukas Wunner
2024-12-16  5:21     ` Manivannan Sadhasivam
2024-12-16  8:26       ` Manivannan Sadhasivam

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=20241216051521.riyy5radru6rxqhg@thinkpad \
    --to=manivannan.sadhasivam@linaro.org \
    --cc=andersson@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=brgl@bgdev.pl \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=quic_qianyu@quicinc.com \
    --cc=robh@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox