aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bcma/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/bcma/main.c')
-rw-r--r--drivers/bcma/main.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
index ec31f7dd5549..b8379b90d045 100644
--- a/drivers/bcma/main.c
+++ b/drivers/bcma/main.c
@@ -13,6 +13,12 @@
13MODULE_DESCRIPTION("Broadcom's specific AMBA driver"); 13MODULE_DESCRIPTION("Broadcom's specific AMBA driver");
14MODULE_LICENSE("GPL"); 14MODULE_LICENSE("GPL");
15 15
16/* contains the number the next bus should get. */
17static unsigned int bcma_bus_next_num = 0;
18
19/* bcma_buses_mutex locks the bcma_bus_next_num */
20static DEFINE_MUTEX(bcma_buses_mutex);
21
16static int bcma_bus_match(struct device *dev, struct device_driver *drv); 22static int bcma_bus_match(struct device *dev, struct device_driver *drv);
17static int bcma_device_probe(struct device *dev); 23static int bcma_device_probe(struct device *dev);
18static int bcma_device_remove(struct device *dev); 24static int bcma_device_remove(struct device *dev);
@@ -93,7 +99,7 @@ static int bcma_register_cores(struct bcma_bus *bus)
93 99
94 core->dev.release = bcma_release_core_dev; 100 core->dev.release = bcma_release_core_dev;
95 core->dev.bus = &bcma_bus_type; 101 core->dev.bus = &bcma_bus_type;
96 dev_set_name(&core->dev, "bcma%d:%d", 0/*bus->num*/, dev_id); 102 dev_set_name(&core->dev, "bcma%d:%d", bus->num, dev_id);
97 103
98 switch (bus->hosttype) { 104 switch (bus->hosttype) {
99 case BCMA_HOSTTYPE_PCI: 105 case BCMA_HOSTTYPE_PCI:
@@ -132,11 +138,15 @@ static void bcma_unregister_cores(struct bcma_bus *bus)
132 } 138 }
133} 139}
134 140
135int bcma_bus_register(struct bcma_bus *bus) 141int __devinit bcma_bus_register(struct bcma_bus *bus)
136{ 142{
137 int err; 143 int err;
138 struct bcma_device *core; 144 struct bcma_device *core;
139 145
146 mutex_lock(&bcma_buses_mutex);
147 bus->num = bcma_bus_next_num++;
148 mutex_unlock(&bcma_buses_mutex);
149
140 /* Scan for devices (cores) */ 150 /* Scan for devices (cores) */
141 err = bcma_bus_scan(bus); 151 err = bcma_bus_scan(bus);
142 if (err) { 152 if (err) {