020-bcma-from-4.5.patch 1.0 KB

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