Skip to contentSkip to conversation

mtd: bcm47: convert to module_platform_driver instead of init/exit

PATCH RESEND In review Libo Chen 3 participants 3 messages May 30, 2013 Memory technology devices (MTD)

lore
Share & tools
lore

Libo Chen

author
#0 lore raw

PATCH RESEND 2/2 mtd: bcm47: convert to module_platform_driver instead of init/exit

convert to module_platform_driver instead of init/exit

---
 drivers/mtd/devices/bcm47xxsflash.c |   20 +-------------------
 1 files changed, 1 insertions(+), 19 deletions(-)
drivers/mtd/devices/bcm47xxsflash.c +1 -19
index 2630d5c..54230cd 100644
@@ -108,22 +108,4 @@ static struct platform_driver bcma_sflash_driver = {
  * Init
  **************************************************/
 
-static int __init bcm47xxsflash_init(void)
-{
-	int err;
-
-	err = platform_driver_register(&bcma_sflash_driver);
-	if (err)
-		pr_err("Failed to register BCMA serial flash driver: %d\n",
-		       err);
-
-	return err;
-}
-
-static void __exit bcm47xxsflash_exit(void)
-{
-	platform_driver_unregister(&bcma_sflash_driver);
-}
-
-module_init(bcm47xxsflash_init);
-module_exit(bcm47xxsflash_exit);
+module_platform_driver(bcma_sflash_driver);
Signature · 1 line
1.7.1
#1 lore raw
Quoted 2 lines · Libo Chen

convert to module_platform_driver instead of init/exit

I give another thought about it. We have to be sure that the flash device will be online when it's really needed.
module_init initcall is quite far in the boot process. Is it what we want?

Quoted 27 lines
drivers/mtd/devices/bcm47xxsflash.c +1 -20
@@ -108,22 +108,4 @@ static struct platform_driver bcma_sflash_driver = {
  * Init
  **************************************************/
 
-static int __init bcm47xxsflash_init(void)
-{
-       int err;
-
-       err = platform_driver_register(&bcma_sflash_driver);
-       if (err)
-               pr_err("Failed to register BCMA serial flash driver: %d\n",
-                      err);
-
-       return err;
-}
-
-static void __exit bcm47xxsflash_exit(void)
-{
-       platform_driver_unregister(&bcma_sflash_driver);
-}
-
-module_init(bcm47xxsflash_init);
-module_exit(bcm47xxsflash_exit);
+module_platform_driver(bcma_sflash_driver);
--
Quoted 3 lines

1.7.1

--
With Best Regards,
Andy Shevchenko

#2 lore raw
Quoted 7 lines · Andy Shevchenko
Quoted 2 lines · Libo Chen

convert to module_platform_driver instead of init/exit

I give another thought about it. We have to be sure that the flash device will be online when it's really needed.
module_init initcall is quite far in the boot process. Is it what we want?

This is no problem, the flash driver is needed when the root file system is mounted. The arch code reads the SoC configuration values in its own code in arch/mips/bcm47xx/nvram.c without using the mtd subsystem. These values are needed very early in the boot process.

Hauke