Skip to content

Commit a395135

Browse files
rmileckilinvjw
authored andcommitted
bcma: use separated function to initialize bus on SoC
This is required to split SoC bus init into two phases. The later one (which includes scanning) should be called when kalloc is available. Cc: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Acked-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent dc8ecdd commit a395135

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

‎arch/mips/bcm47xx/setup.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ static void __init bcm47xx_register_bcma(void)
201201
pr_warn("bcm47xx: someone else already registered a bcma SPROM callback handler (err %d)\n", err);
202202

203203
err = bcma_host_soc_register(&bcm47xx_bus.bcma);
204+
if (err)
205+
panic("Failed to register BCMA bus (err %d)", err);
206+
207+
err = bcma_host_soc_init(&bcm47xx_bus.bcma);
204208
if (err)
205209
panic("Failed to initialize BCMA bus (err %d)", err);
206210

‎drivers/bcma/host_soc.c‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ static const struct bcma_host_ops bcma_host_soc_ops = {
165165
int __init bcma_host_soc_register(struct bcma_soc *soc)
166166
{
167167
struct bcma_bus *bus = &soc->bus;
168-
int err;
169168

170169
/* iomap only first core. We have to read some register on this core
171170
* to scan the bus.
@@ -181,7 +180,15 @@ int __init bcma_host_soc_register(struct bcma_soc *soc)
181180
/* Initialize struct, detect chip */
182181
bcma_init_bus(bus);
183182

184-
/* Register */
183+
return 0;
184+
}
185+
186+
int __init bcma_host_soc_init(struct bcma_soc *soc)
187+
{
188+
struct bcma_bus *bus = &soc->bus;
189+
int err;
190+
191+
/* Scan bus and initialize it */
185192
err = bcma_bus_early_register(bus, &soc->core_cc, &soc->core_mips);
186193
if (err)
187194
iounmap(bus->mmio);

‎include/linux/bcma/bcma_soc.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ struct bcma_soc {
1010
};
1111

1212
int __init bcma_host_soc_register(struct bcma_soc *soc);
13+
int __init bcma_host_soc_init(struct bcma_soc *soc);
1314

1415
int bcma_bus_register(struct bcma_bus *bus);
1516

0 commit comments

Comments
 (0)