1 From 666bdfc027cde41a171862dc698987a378c8b66a Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
3 Date: Mon, 9 Feb 2015 18:00:42 +0100
4 Subject: [PATCH RFC] bcma: use two different initcalls if built-in
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 This is needed as we can't initialize bus during fs_initcall.
10 Initialization requires SPROM which depends on NVRAM which depends on
11 mtd. Since mtd, spi, nand, spi-nor use standard module_init, we have to
13 Without this we'll try to initialize SPROM without having a ready SPROM
14 proviver registered using bcma_arch_register_fallback_sprom.
16 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
18 While this patch seems to work and I can compile bcma as built-in and
19 module, I'm not too proud of it. I don't really like these #if(n)def
20 tricks and I'm afraid bcma_modinit may be called even if
21 bcma_modinit_early failed.
23 Do you see any better idea of solving this?
25 drivers/bcma/main.c | 16 ++++++++++++++--
26 1 file changed, 14 insertions(+), 2 deletions(-)
28 --- a/drivers/bcma/main.c
29 +++ b/drivers/bcma/main.c
30 @@ -637,13 +637,25 @@ static int bcma_device_uevent(struct dev
31 core->id.rev, core->id.class);
34 +/* Bus has to be registered early, before any bcma driver */
35 +static int __init bcma_modinit_early(void)
37 + return bus_register(&bcma_bus_type);
40 +fs_initcall(bcma_modinit_early);
43 +/* Initialization has to be done later with SPI/mtd/NAND/SPROM available */
44 static int __init bcma_modinit(void)
48 - err = bus_register(&bcma_bus_type);
50 + err = bcma_modinit_early();
55 err = bcma_host_soc_register_driver();
57 @@ -660,7 +672,7 @@ static int __init bcma_modinit(void)
61 -fs_initcall(bcma_modinit);
62 +module_init(bcma_modinit);
64 static void __exit bcma_modexit(void)