Re: [PATCH v4 0/3] PCI: pciehp: Do not turn off slot if presence comes up after link

From: Bjorn Helgaas
Date: Tue Feb 11 2020 - 14:31:38 EST


On Tue, Feb 11, 2020 at 03:32:02PM +0100, Lukas Wunner wrote:
> On Tue, Feb 11, 2020 at 08:14:44AM -0600, Bjorn Helgaas wrote:
> > I'm a little confused about why pci_hp_initialize()/
> > __pci_hp_initialize()/pci_hp_register()/__pci_hp_register() is such a
> > rat's nest with hotplug drivers using a mix of them.
>
> This is modeled after device registration, which can be done either
> in two steps (device_initialize() + device_add()) or in 1 step
> (device_register()).
>
> So it's either pci_hp_initialize() + pci_hp_add() or pci_hp_register().
>
> The rationale is provided in the commit message of 51bbf9bee34f
> ("PCI: hotplug: Demidlayer registration with the core").

Thanks for the pointer. I wrote that down in case I ever try to
figure that out in the future. Obviously I haven't looked at this in
any detail, but it seems like the sort of thing that all the hotplug
drivers should do the same way regardless of their internal structure,
and the slot concept seems pretty integral to the bridge leading to
it. Maybe this is a somehow a consequence of the hotplug drivers
being separated from the enumeration path. Or maybe the slot part
could be split out from the hotplug drivers and done during
enumeration. Just blue sky thinking, I don't pretend to have done
any actual research here.

Bjorn