kernel: fix ip6_tunnel compilation
[openwrt.git] / target / linux / generic / patches-4.4 / 020-bcma-from-4.5.patch
1 --- a/drivers/bcma/main.c
2 +++ b/drivers/bcma/main.c
3 @@ -668,11 +668,36 @@ static int bcma_device_uevent(struct dev
4                               core->id.rev, core->id.class);
5  }
6  
7 -static int __init bcma_modinit(void)
8 +static unsigned int bcma_bus_registered;
9 +
10 +/*
11 + * If built-in, bus has to be registered early, before any driver calls
12 + * bcma_driver_register.
13 + * Otherwise registering driver would trigger BUG in driver_register.
14 + */
15 +static int __init bcma_init_bus_register(void)
16  {
17         int err;
18  
19 +       if (bcma_bus_registered)
20 +               return 0;
21 +
22         err = bus_register(&bcma_bus_type);
23 +       if (!err)
24 +               bcma_bus_registered = 1;
25 +
26 +       return err;
27 +}
28 +#ifndef MODULE
29 +fs_initcall(bcma_init_bus_register);
30 +#endif
31 +
32 +/* Main initialization has to be done with SPI/mtd/NAND/SPROM available */
33 +static int __init bcma_modinit(void)
34 +{
35 +       int err;
36 +
37 +       err = bcma_init_bus_register();
38         if (err)
39                 return err;
40  
41 @@ -691,7 +716,7 @@ static int __init bcma_modinit(void)
42  
43         return err;
44  }
45 -fs_initcall(bcma_modinit);
46 +module_init(bcma_modinit);
47  
48  static void __exit bcma_modexit(void)
49  {