]> git.karo-electronics.de Git - linux-beck.git/commitdiff
bcma: clean bus initialization code
authorRafał Miłecki <zajec5@gmail.com>
Fri, 16 Jan 2015 19:59:39 +0000 (20:59 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 23 Jan 2015 17:44:58 +0000 (19:44 +0200)
This moves main bus init code to the main.c and renames old function to
make its purpose clear.
Thanks to this change we'll also be able to separate scanning from
registration (and support PCIe Gen 2 devices) in the future.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/bcma/bcma_private.h
drivers/bcma/main.c
drivers/bcma/scan.c

index 314ae4032f3e7347ee2f4d391bab32964fad0594..59422b5fa46c34f0e39941a0d67b9f9cf942b239 100644 (file)
@@ -25,6 +25,7 @@ struct bcma_bus;
 bool bcma_wait_value(struct bcma_device *core, u16 reg, u32 mask, u32 value,
                     int timeout);
 void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core);
+void bcma_init_bus(struct bcma_bus *bus);
 int bcma_bus_register(struct bcma_bus *bus);
 void bcma_bus_unregister(struct bcma_bus *bus);
 int __init bcma_bus_early_register(struct bcma_bus *bus,
@@ -36,11 +37,11 @@ int bcma_bus_resume(struct bcma_bus *bus);
 #endif
 
 /* scan.c */
+void bcma_detect_chip(struct bcma_bus *bus);
 int bcma_bus_scan(struct bcma_bus *bus);
 int __init bcma_bus_scan_early(struct bcma_bus *bus,
                               struct bcma_device_id *match,
                               struct bcma_device *core);
-void bcma_init_bus(struct bcma_bus *bus);
 
 /* sprom.c */
 int bcma_sprom_get(struct bcma_bus *bus);
index 534e1337766d2d0ba9d7e8d220a30434da23ef5d..c166d444fef65aa35b0fe50ffff5f2b268f7f67b 100644 (file)
@@ -268,6 +268,18 @@ void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core)
        }
 }
 
+void bcma_init_bus(struct bcma_bus *bus)
+{
+       mutex_lock(&bcma_buses_mutex);
+       bus->num = bcma_bus_next_num++;
+       mutex_unlock(&bcma_buses_mutex);
+
+       INIT_LIST_HEAD(&bus->cores);
+       bus->nr_cores = 0;
+
+       bcma_detect_chip(bus);
+}
+
 static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core)
 {
        int err;
@@ -369,10 +381,6 @@ int bcma_bus_register(struct bcma_bus *bus)
        int err;
        struct bcma_device *core;
 
-       mutex_lock(&bcma_buses_mutex);
-       bus->num = bcma_bus_next_num++;
-       mutex_unlock(&bcma_buses_mutex);
-
        /* Scan for devices (cores) */
        err = bcma_bus_scan(bus);
        if (err) {
index 917520776879255c94350f5458e079ecb07df062..5328ee5b4df05547a26be8125eab785e6cb91eb0 100644 (file)
@@ -435,15 +435,12 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
        return 0;
 }
 
-void bcma_init_bus(struct bcma_bus *bus)
+void bcma_detect_chip(struct bcma_bus *bus)
 {
        s32 tmp;
        struct bcma_chipinfo *chipinfo = &(bus->chipinfo);
        char chip_id[8];
 
-       INIT_LIST_HEAD(&bus->cores);
-       bus->nr_cores = 0;
-
        bcma_scan_switch_core(bus, BCMA_ADDR_BASE);
 
        tmp = bcma_scan_read32(bus, 0, BCMA_CC_ID);