On Fri, Jul 20, 2018 at 10:18:41AM +0200, Lukas Wunner wrote: > I'm wondering if we should be checking hotplug_is_native() instead of > pciehp_is_native() in pci_bridge_d3_possible(). There appears to be > an ordering issue if we do that because shpchp_is_native() checks > bridge->shpc_managed, but that is only set to true by shpc_probe(). > Now the problem is, the shpc pci_driver is registered with module_init(). > If shpc is built-in, that becomes a device_initcall(). > > And pci_bridge_d3_possible() is called from pcie_portdrv_probe(), > and portdrv is also registered with a device_initcall(). > > Thus, if hotplug_is_native() is called from pci_bridge_d3_possible(), > it's result in the shpc case depends on the link order if shpc is > built-in. If shpc is a module, it will always return false for the > shpc case. > > I'm sorry, I'm pretty clueless about shpc and whether or not portdrv > should activate runtime PM whether an shpc port is controlled by > the firmware. We only enable D3 for PCIe ports in pci_bridge_d3_possible(). We don't do it for conventional PCI so I think calling pciehp_is_native() there is the right thing to do.