diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2015-01-24 12:47:19 -0500 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2015-01-29 03:49:28 -0500 |
commit | 17fbaa6e426bf88226551374e3255f51220a22a6 (patch) | |
tree | 05aa8ee6379bd2b760d13c895bbe6c3c975a7908 /drivers/bcma | |
parent | 68fcd24503a8222657c99604bdb23713e344bee7 (diff) |
bcma: simplify freeing cores (internal devices structs)
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/bcma')
-rw-r--r-- | drivers/bcma/main.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c index c3c5e0a2d5be..73b2ee3de972 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) |
@@ -467,7 +474,6 @@ int bcma_bus_register(struct bcma_bus *bus) | |||
467 | 474 | ||
468 | void bcma_bus_unregister(struct bcma_bus *bus) | 475 | void bcma_bus_unregister(struct bcma_bus *bus) |
469 | { | 476 | { |
470 | struct bcma_device *cores[3]; | ||
471 | int err; | 477 | int err; |
472 | 478 | ||
473 | err = bcma_gpio_unregister(&bus->drv_cc); | 479 | err = bcma_gpio_unregister(&bus->drv_cc); |
@@ -478,15 +484,7 @@ void bcma_bus_unregister(struct bcma_bus *bus) | |||
478 | 484 | ||
479 | bcma_core_chipcommon_b_free(&bus->drv_cc_b); | 485 | bcma_core_chipcommon_b_free(&bus->drv_cc_b); |
480 | 486 | ||
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); | 487 | bcma_unregister_cores(bus); |
486 | |||
487 | kfree(cores[2]); | ||
488 | kfree(cores[1]); | ||
489 | kfree(cores[0]); | ||
490 | } | 488 | } |
491 | 489 | ||
492 | /* | 490 | /* |