Re: [PATCH v3] PCI/portdrv: Allow probing even without child services
Bjorn Helgaas <[email protected]> Thu, 16 Jul 2026 12:21:39 -0500
| Newsgroups | dev.linux.lists.sashiko,org.kernel.vger.linux-pci |
|---|---|
| Message-ID | <20260716172139.GA11585@bhelgaas> |
On Wed, Jul 15, 2026 at 05:08:02PM -0700, Brian Norris wrote:
> On Wed, Jul 15, 2026 at 05:15:26PM -0500, Bjorn Helgaas wrote:
> > On Fri, May 08, 2026 at 05:12:19PM -0700, Brian Norris wrote:
> ...
> Thanks for looking! Can you describe what your goals are here vs my v2?
> I'm curious what you're aiming for.
I was concerned about pci_clear_master() potentially breaking a driver
for a downstream driver, but I don't think that should happen because
portdrv cannot be a module and should always probe before any
downstream device.
> ...
> > -static int pcie_port_device_register(struct pci_dev *dev)
> > +static void pcie_port_device_register(struct pci_dev *dev)
> > {
> > int status, capabilities, i, nr_service;
> > int irqs[PCIE_PORT_DEVICE_MAXSERVICES];
> > @@ -336,12 +336,12 @@ static int pcie_port_device_register(struct pci_dev *dev)
> > /* Enable PCI Express port device */
> > status = pci_enable_device(dev);
> > if (status)
> > - return status;
> > + return;
>
> Are you purposely ignoring pci_enable_state() failures now too? That
> wasn't part of my original proposal. This also means you have a
> potential underflow in remove(), because now a port might get through
> probe() with an enable_cnt of 0 -- then we still call
> pci_disable_device() in remove().
Good point. pci_enable_device() enables BARs, which we only need for
MSI-X tables. I was thinking portdrv may still be useful for power
management even if pci_enable_device() fails because we couldn't
assign space for BARs. But that failure is pretty unlikely.