Re: [PATCH v2] PCI/pwrctrl: Skip creating pwrctrl device unless CONFIG_PCI_PWRCTRL is enabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[+cc Bart]

On Tue, Jul 01, 2025 at 12:17:31PM +0530, Manivannan Sadhasivam wrote:
> If devicetree describes power supplies related to a PCI device, we
> previously created a pwrctrl device even if CONFIG_PCI_PWRCTL was
> not enabled.
> 
> When pci_pwrctrl_create_device() creates and returns a pwrctrl device,
> pci_scan_device() doesn't enumerate the PCI device. It assumes the pwrctrl
> core will rescan the bus after turning on the power. However, if
> CONFIG_PCI_PWRCTL is not enabled, the rescan never happens.

Separate from this patch, can we refine the comment in
pci_scan_device() to explain *why* we should skip scanning if a
pwrctrl device was created?  The current comment leaves me with two
questions:

  1) How do we know the pwrctrl device is currently off?  If it is
     already on, why should we defer enumerating the device?

  2) If the pwrctrl device is currently off, won't the Vendor ID read
     just fail like it does for every other non-existent device?  If
     so, why can't we just let that happen?

This behavior is from 2489eeb777af ("PCI/pwrctrl: Skip scanning for
the device further if pwrctrl device is created"), which just says
"there's no need to continue scanning."  Prior to 2489eeb777af, it
looks like we *did* what try to enumerate the device even if a pwrctrl
device was created, and 2489eeb777af doesn't mention a bug fix, so I
assume it's just an optimization.

Bjorn




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux