From 166a6ba9559c109d27a1db822214fc6866dfb953 Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Wed, 30 Jul 2014 10:39:36 +0200 Subject: pci: register device after BAR setup As soon as pci_register_device is called, a potential driver will access its registers. This requires BARs to be set up properly, so move pci_register_device after BAR setup. Signed-off-by: Sebastian Hesselbarth Acked-by: Lucas Stach Signed-off-by: Sascha Hauer --- drivers/pci/pci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/pci/pci.c') diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 83d44fc103..f58e2c98f1 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -186,9 +186,6 @@ unsigned int pci_scan_bus(struct pci_bus *bus) DBG("PCI: %02x:%02x [%04x/%04x]\n", bus->number, dev->devfn, dev->vendor, dev->device); - list_add_tail(&dev->bus_list, &bus->devices); - pci_register_device(dev); - if (class == PCI_CLASS_BRIDGE_HOST) { DBG("PCI: skip pci host bridge\n"); continue; @@ -235,6 +232,9 @@ unsigned int pci_scan_bus(struct pci_bus *bus) if (dev->resource[bar].flags & IORESOURCE_MEM_64) bar++; } + + list_add_tail(&dev->bus_list, &bus->devices); + pci_register_device(dev); } /* -- cgit v1.2.3