diff options
| author | Hauke Mehrtens <hauke@hauke-m.de> | 2012-01-30 18:03:36 -0500 |
|---|---|---|
| committer | John W. Linville <linville@tuxdriver.com> | 2012-02-06 14:53:05 -0500 |
| commit | 8f9ada4fa1926e540b1562cb9bacb3e51a698c35 (patch) | |
| tree | def07cbceee8d55da9288ab1157835d784360805 | |
| parent | 49dc9577155576b10ff79f0c1486c816b01f58bf (diff) | |
bcma: add bus num counter
If we have two bcma buses on one computer the second will not work
without this patch. Now each bus gets an own number.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
| -rw-r--r-- | drivers/bcma/main.c | 12 | ||||
| -rw-r--r-- | include/linux/bcma/bcma.h | 1 |
2 files changed, 12 insertions, 1 deletions
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c index 3363036f23dc..bcd1c01cde9e 100644 --- a/drivers/bcma/main.c +++ b/drivers/bcma/main.c | |||
| @@ -13,6 +13,12 @@ | |||
| 13 | MODULE_DESCRIPTION("Broadcom's specific AMBA driver"); | 13 | MODULE_DESCRIPTION("Broadcom's specific AMBA driver"); |
| 14 | MODULE_LICENSE("GPL"); | 14 | MODULE_LICENSE("GPL"); |
| 15 | 15 | ||
| 16 | /* contains the number the next bus should get. */ | ||
| 17 | static unsigned int bcma_bus_next_num = 0; | ||
| 18 | |||
| 19 | /* bcma_buses_mutex locks the bcma_bus_next_num */ | ||
| 20 | static DEFINE_MUTEX(bcma_buses_mutex); | ||
| 21 | |||
| 16 | static int bcma_bus_match(struct device *dev, struct device_driver *drv); | 22 | static int bcma_bus_match(struct device *dev, struct device_driver *drv); |
| 17 | static int bcma_device_probe(struct device *dev); | 23 | static int bcma_device_probe(struct device *dev); |
| 18 | static int bcma_device_remove(struct device *dev); | 24 | static 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: |
| @@ -137,6 +143,10 @@ int __devinit bcma_bus_register(struct bcma_bus *bus) | |||
| 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) { |
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h index 024a6e2a9083..b9f65fbee42f 100644 --- a/include/linux/bcma/bcma.h +++ b/include/linux/bcma/bcma.h | |||
| @@ -196,6 +196,7 @@ struct bcma_bus { | |||
| 196 | struct list_head cores; | 196 | struct list_head cores; |
| 197 | u8 nr_cores; | 197 | u8 nr_cores; |
| 198 | u8 init_done:1; | 198 | u8 init_done:1; |
| 199 | u8 num; | ||
| 199 | 200 | ||
| 200 | struct bcma_drv_cc drv_cc; | 201 | struct bcma_drv_cc drv_cc; |
| 201 | struct bcma_drv_pci drv_pci; | 202 | struct bcma_drv_pci drv_pci; |
