Currently, all PCI controllers are registered with struct pci_bus
number set to zero. Allow to set the bus number before registering
the controller and scan the bus.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
To: [email protected]
To: Sebastian Hesselbarth <[email protected]>
Cc: Antony Pavlov <[email protected]>
Cc: Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
Cc: Thomas Petazzoni <[email protected]>
Cc: Ezequiel Garcia <[email protected]>
---
 arch/mips/mach-malta/pci.c | 2 +-
 drivers/pci/pci.c          | 3 ++-
 include/linux/pci.h        | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/mips/mach-malta/pci.c b/arch/mips/mach-malta/pci.c
index 90351758e06d..47bfb4cc0833 100644
--- a/arch/mips/mach-malta/pci.c
+++ b/arch/mips/mach-malta/pci.c
@@ -229,7 +229,7 @@ static int pcibios_init(void)
                GT_WRITE(GT_PCI0IOREMAP_OFS, map);
        }
 
-       register_pci_controller(&gt64120_controller);
+       register_pci_controller(&gt64120_controller, 0);
 
        return 0;
 }
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index b30cdd96f8ca..f755d13e14ee 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -27,7 +27,7 @@ static struct pci_bus *pci_alloc_bus(void)
        return b;
 }
 
-void register_pci_controller(struct pci_controller *hose)
+void register_pci_controller(struct pci_controller *hose, int num)
 {
        struct pci_bus *bus;
 
@@ -39,6 +39,7 @@ void register_pci_controller(struct pci_controller *hose)
        bus->ops = hose->pci_ops;
        bus->resource[0] = hose->mem_resource;
        bus->resource[1] = hose->io_resource;
+       bus->number = num;
        bus->sysdata = hose;
 
        pci_scan_bus(bus);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 6caed01c9939..c044225c3ecb 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -246,7 +246,7 @@ int pci_register_device(struct pci_dev *pdev);
 extern struct list_head pci_root_buses; /* list of all known PCI buses */
 
 extern unsigned int pci_scan_bus(struct pci_bus *bus);
-extern void register_pci_controller(struct pci_controller *hose);
+extern void register_pci_controller(struct pci_controller *hose, int num);
 
 int pci_bus_read_config_byte(struct pci_bus *bus, unsigned int devfn,
                             int where, u8 *val);
-- 
2.0.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to