Message ID | 20170426111809.19922-2-lorenzo.pieralisi@arm.com (mailing list archive) |
---|---|
State | New, archived |
Delegated to: | Bjorn Helgaas |
Headers | show |
On Wed, Apr 26, 2017 at 1:17 PM, Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> wrote: > The introduction of pci_register_host_bridge() kernel interface > allows PCI host controller drivers to create the struct pci_host_bridge > object, initialize it and register it with the kernel so that its > corresponding PCI bus can be scanned and its devices probed. > > The host bridge device release function pci_release_host_bridge_dev is a > static function common for all struct pci_host_bridge allocated objects, > so in its current form cannot be used by PCI host bridge controllers > drivers to initialize the allocated struct pci_host_bridge, which > leaves struct pci_host_bridge devices release function uninitialized. > > Since pci_release_host_bridge_dev is a function common to all PCI > host bridge objects, initialize it in pci_alloc_host_bridge() (ie > common host bridge allocation interface) so that all struct > pci_host_bridge objects have their release function initialized by > default at allocation time, removing the need for exporting the > common pci_release_host_bridge_dev function to other compilation > units. > > Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> > Cc: Arnd Bergmann <arnd@arndb.de> > Cc: Bjorn Helgaas <bhelgaas@google.com> Makes sense. I think originally I did not have the bridge->release_fn callback, so drivers would have to provide their won release callback, but this is no longer needed as they can override the release_fn instead. Acked-by: Arnd Bergmann <arnd@arndb.de>
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index dfc9a27..d0ddb69 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -531,6 +531,7 @@ struct pci_host_bridge *pci_alloc_host_bridge(size_t priv) return NULL; INIT_LIST_HEAD(&bridge->windows); + bridge->dev.release = pci_release_host_bridge_dev; return bridge; } @@ -2317,7 +2318,6 @@ static struct pci_bus *pci_create_root_bus_msi(struct device *parent, return NULL; bridge->dev.parent = parent; - bridge->dev.release = pci_release_host_bridge_dev; list_splice_init(resources, &bridge->windows); bridge->sysdata = sysdata;
The introduction of pci_register_host_bridge() kernel interface allows PCI host controller drivers to create the struct pci_host_bridge object, initialize it and register it with the kernel so that its corresponding PCI bus can be scanned and its devices probed. The host bridge device release function pci_release_host_bridge_dev is a static function common for all struct pci_host_bridge allocated objects, so in its current form cannot be used by PCI host bridge controllers drivers to initialize the allocated struct pci_host_bridge, which leaves struct pci_host_bridge devices release function uninitialized. Since pci_release_host_bridge_dev is a function common to all PCI host bridge objects, initialize it in pci_alloc_host_bridge() (ie common host bridge allocation interface) so that all struct pci_host_bridge objects have their release function initialized by default at allocation time, removing the need for exporting the common pci_release_host_bridge_dev function to other compilation units. Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Bjorn Helgaas <bhelgaas@google.com> --- drivers/pci/probe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)