Merge branch 'linux-next' of git://cavan.codon.org.uk/platform-drivers-x86
[deliverable/linux.git] / drivers / bcma / scan.c
index a0272bbfc4f65d26ed5fb3e19f1fa549300115c3..8d0b57164018d7f14cdacccb3214bd6fe6008c3b 100644 (file)
@@ -21,6 +21,7 @@ struct bcma_device_id_name {
 };
 
 static const struct bcma_device_id_name bcma_arm_device_names[] = {
+       { BCMA_CORE_4706_MAC_GBIT_COMMON, "BCM4706 GBit MAC Common" },
        { BCMA_CORE_ARM_1176, "ARM 1176" },
        { BCMA_CORE_ARM_7TDMI, "ARM 7TDMI" },
        { BCMA_CORE_ARM_CM3, "ARM CM3" },
@@ -33,7 +34,6 @@ static const struct bcma_device_id_name bcma_bcm_device_names[] = {
        { BCMA_CORE_4706_MAC_GBIT, "BCM4706 GBit MAC" },
        { BCMA_CORE_AMEMC, "AMEMC (DDR)" },
        { BCMA_CORE_ALTA, "ALTA (I2S)" },
-       { BCMA_CORE_4706_MAC_GBIT_COMMON, "BCM4706 GBit MAC Common" },
        { BCMA_CORE_INVALID, "Invalid" },
        { BCMA_CORE_CHIPCOMMON, "ChipCommon" },
        { BCMA_CORE_ILINE20, "ILine 20" },
@@ -295,11 +295,15 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
 
        /* check if component is a core at all */
        if (wrappers[0] + wrappers[1] == 0) {
-               /* we could save addrl of the router
-               if (cid == BCMA_CORE_OOB_ROUTER)
-                */
-               bcma_erom_skip_component(bus, eromptr);
-               return -ENXIO;
+               /* Some specific cores don't need wrappers */
+               switch (core->id.id) {
+               case BCMA_CORE_4706_MAC_GBIT_COMMON:
+               /* Not used yet: case BCMA_CORE_OOB_ROUTER: */
+                       break;
+               default:
+                       bcma_erom_skip_component(bus, eromptr);
+                       return -ENXIO;
+               }
        }
 
        if (bcma_erom_is_bridge(bus, eromptr)) {
@@ -458,8 +462,10 @@ int bcma_bus_scan(struct bcma_bus *bus)
        while (eromptr < eromend) {
                struct bcma_device *other_core;
                struct bcma_device *core = kzalloc(sizeof(*core), GFP_KERNEL);
-               if (!core)
-                       return -ENOMEM;
+               if (!core) {
+                       err = -ENOMEM;
+                       goto out;
+               }
                INIT_LIST_HEAD(&core->list);
                core->bus = bus;
 
@@ -474,7 +480,7 @@ int bcma_bus_scan(struct bcma_bus *bus)
                        } else if (err == -ESPIPE) {
                                break;
                        }
-                       return err;
+                       goto out;
                }
 
                core->core_index = core_num++;
@@ -487,13 +493,15 @@ int bcma_bus_scan(struct bcma_bus *bus)
                          core->id.manuf, core->id.id, core->id.rev,
                          core->id.class);
 
-               list_add(&core->list, &bus->cores);
+               list_add_tail(&core->list, &bus->cores);
        }
 
+       err = 0;
+out:
        if (bus->hosttype == BCMA_HOSTTYPE_SOC)
                iounmap(eromptr);
 
-       return 0;
+       return err;
 }
 
 int __init bcma_bus_scan_early(struct bcma_bus *bus,
@@ -533,7 +541,7 @@ int __init bcma_bus_scan_early(struct bcma_bus *bus,
                else if (err == -ESPIPE)
                        break;
                else if (err < 0)
-                       return err;
+                       goto out;
 
                core->core_index = core_num++;
                bus->nr_cores++;
@@ -542,11 +550,12 @@ int __init bcma_bus_scan_early(struct bcma_bus *bus,
                          core->id.manuf, core->id.id, core->id.rev,
                          core->id.class);
 
-               list_add(&core->list, &bus->cores);
+               list_add_tail(&core->list, &bus->cores);
                err = 0;
                break;
        }
 
+out:
        if (bus->hosttype == BCMA_HOSTTYPE_SOC)
                iounmap(eromptr);
 
This page took 0.025228 seconds and 5 git commands to generate.