summaryrefslogtreecommitdiffstats
path: root/drivers/bcma
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2015-12-17 14:53:54 -0500
committerKalle Valo <kvalo@codeaurora.org>2015-12-31 03:17:05 -0500
commit0510931ef5e89d67f1c87c792219733972069269 (patch)
tree42671868eb856dcfdfe4baa756d328e76cc4ce23 /drivers/bcma
parentf99551a2d39dc26ea03dc6761be11ac913eb2d57 (diff)
bcma: use module_init for the main part of bus initialization
So far we were using fs_initcall. It was (and still is) needed because struct bus_type has to be registered early. However main bus initialization has to happen later as it requires SPROM which depends on NVRAM which depends on mtd. Solve it by using fs_initcall only for bus_register call and module_init for the rest. It affects bcma only when built-in obviously. This was tested with BCM4706 and BCM5357C0 (BCM47XX), BCM4708A0 (ARCH_BCM_5301X) and BCM43225 (PCIe card with bcma as module). 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.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
index 59d8d0d14824..c466f752b067 100644
--- a/drivers/bcma/main.c
+++ b/drivers/bcma/main.c
@@ -668,11 +668,36 @@ static int bcma_device_uevent(struct device *dev, struct kobj_uevent_env *env)
668 core->id.rev, core->id.class); 668 core->id.rev, core->id.class);
669} 669}
670 670
671static int __init bcma_modinit(void) 671static unsigned int bcma_bus_registered;
672
673/*
674 * If built-in, bus has to be registered early, before any driver calls
675 * bcma_driver_register.
676 * Otherwise registering driver would trigger BUG in driver_register.
677 */
678static int __init bcma_init_bus_register(void)
672{ 679{
673 int err; 680 int err;
674 681
682 if (bcma_bus_registered)
683 return 0;
684
675 err = bus_register(&bcma_bus_type); 685 err = bus_register(&bcma_bus_type);
686 if (!err)
687 bcma_bus_registered = 1;
688
689 return err;
690}
691#ifndef MODULE
692fs_initcall(bcma_init_bus_register);
693#endif
694
695/* Main initialization has to be done with SPI/mtd/NAND/SPROM available */
696static int __init bcma_modinit(void)
697{
698 int err;
699
700 err = bcma_init_bus_register();
676 if (err) 701 if (err)
677 return err; 702 return err;
678 703
@@ -691,7 +716,7 @@ static int __init bcma_modinit(void)
691 716
692 return err; 717 return err;
693} 718}
694fs_initcall(bcma_modinit); 719module_init(bcma_modinit);
695 720
696static void __exit bcma_modexit(void) 721static void __exit bcma_modexit(void)
697{ 722{