diff options
Diffstat (limited to 'drivers/bcma/main.c')
-rw-r--r-- | drivers/bcma/main.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c index c3c5e0a2d5be..38bde6eab8a4 100644 --- a/drivers/bcma/main.c +++ b/drivers/bcma/main.c | |||
@@ -368,12 +368,19 @@ static void bcma_unregister_cores(struct bcma_bus *bus) | |||
368 | struct bcma_device *core, *tmp; | 368 | struct bcma_device *core, *tmp; |
369 | 369 | ||
370 | list_for_each_entry_safe(core, tmp, &bus->cores, list) { | 370 | list_for_each_entry_safe(core, tmp, &bus->cores, list) { |
371 | if (!core->dev_registered) | ||
372 | continue; | ||
371 | list_del(&core->list); | 373 | list_del(&core->list); |
372 | if (core->dev_registered) | 374 | device_unregister(&core->dev); |
373 | device_unregister(&core->dev); | ||
374 | } | 375 | } |
375 | if (bus->hosttype == BCMA_HOSTTYPE_SOC) | 376 | if (bus->hosttype == BCMA_HOSTTYPE_SOC) |
376 | platform_device_unregister(bus->drv_cc.watchdog); | 377 | platform_device_unregister(bus->drv_cc.watchdog); |
378 | |||
379 | /* Now noone uses internally-handled cores, we can free them */ | ||
380 | list_for_each_entry_safe(core, tmp, &bus->cores, list) { | ||
381 | list_del(&core->list); | ||
382 | kfree(core); | ||
383 | } | ||
377 | } | 384 | } |
378 | 385 | ||
379 | int bcma_bus_register(struct bcma_bus *bus) | 386 | int bcma_bus_register(struct bcma_bus *bus) |
@@ -395,6 +402,13 @@ int bcma_bus_register(struct bcma_bus *bus) | |||
395 | bcma_core_chipcommon_early_init(&bus->drv_cc); | 402 | bcma_core_chipcommon_early_init(&bus->drv_cc); |
396 | } | 403 | } |
397 | 404 | ||
405 | /* Early init PCIE core */ | ||
406 | core = bcma_find_core(bus, BCMA_CORE_PCIE); | ||
407 | if (core) { | ||
408 | bus->drv_pci[0].core = core; | ||
409 | bcma_core_pci_early_init(&bus->drv_pci[0]); | ||
410 | } | ||
411 | |||
398 | /* Cores providing flash access go before SPROM init */ | 412 | /* Cores providing flash access go before SPROM init */ |
399 | list_for_each_entry(core, &bus->cores, list) { | 413 | list_for_each_entry(core, &bus->cores, list) { |
400 | if (bcma_is_core_needed_early(core->id.id)) | 414 | if (bcma_is_core_needed_early(core->id.id)) |
@@ -467,7 +481,6 @@ int bcma_bus_register(struct bcma_bus *bus) | |||
467 | 481 | ||
468 | void bcma_bus_unregister(struct bcma_bus *bus) | 482 | void bcma_bus_unregister(struct bcma_bus *bus) |
469 | { | 483 | { |
470 | struct bcma_device *cores[3]; | ||
471 | int err; | 484 | int err; |
472 | 485 | ||
473 | err = bcma_gpio_unregister(&bus->drv_cc); | 486 | err = bcma_gpio_unregister(&bus->drv_cc); |
@@ -478,15 +491,7 @@ void bcma_bus_unregister(struct bcma_bus *bus) | |||
478 | 491 | ||
479 | bcma_core_chipcommon_b_free(&bus->drv_cc_b); | 492 | bcma_core_chipcommon_b_free(&bus->drv_cc_b); |
480 | 493 | ||
481 | cores[0] = bcma_find_core(bus, BCMA_CORE_MIPS_74K); | ||
482 | cores[1] = bcma_find_core(bus, BCMA_CORE_PCIE); | ||
483 | cores[2] = bcma_find_core(bus, BCMA_CORE_4706_MAC_GBIT_COMMON); | ||
484 | |||
485 | bcma_unregister_cores(bus); | 494 | bcma_unregister_cores(bus); |
486 | |||
487 | kfree(cores[2]); | ||
488 | kfree(cores[1]); | ||
489 | kfree(cores[0]); | ||
490 | } | 495 | } |
491 | 496 | ||
492 | /* | 497 | /* |