Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: convert drivers/mtd/* to use module_platform_driver()

This patch converts the drivers in drivers/mtd/* to use the
module_platform_driver() macro which makes the code smaller and a bit
simpler.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

authored by

Axel Lin and committed by
David Woodhouse
f99640de 1f9327fc

+30 -345
+1 -12
drivers/mtd/maps/bcm963xx-flash.c
··· 257 257 }, 258 258 }; 259 259 260 - static int __init bcm963xx_mtd_init(void) 261 - { 262 - return platform_driver_register(&bcm63xx_mtd_dev); 263 - } 264 - 265 - static void __exit bcm963xx_mtd_exit(void) 266 - { 267 - platform_driver_unregister(&bcm63xx_mtd_dev); 268 - } 269 - 270 - module_init(bcm963xx_mtd_init); 271 - module_exit(bcm963xx_mtd_exit); 260 + module_platform_driver(bcm63xx_mtd_dev); 272 261 273 262 MODULE_LICENSE("GPL"); 274 263 MODULE_DESCRIPTION("Broadcom BCM63xx MTD driver for CFE and RedBoot");
+1 -11
drivers/mtd/maps/bfin-async-flash.c
··· 190 190 }, 191 191 }; 192 192 193 - static int __init bfin_flash_init(void) 194 - { 195 - return platform_driver_register(&bfin_flash_driver); 196 - } 197 - module_init(bfin_flash_init); 198 - 199 - static void __exit bfin_flash_exit(void) 200 - { 201 - platform_driver_unregister(&bfin_flash_driver); 202 - } 203 - module_exit(bfin_flash_exit); 193 + module_platform_driver(bfin_flash_driver); 204 194 205 195 MODULE_LICENSE("GPL"); 206 196 MODULE_DESCRIPTION("MTD map driver for Blackfins with flash/ethernet on same async bank");
+1 -11
drivers/mtd/maps/gpio-addr-flash.c
··· 279 279 }, 280 280 }; 281 281 282 - static int __init gpio_flash_init(void) 283 - { 284 - return platform_driver_register(&gpio_flash_driver); 285 - } 286 - module_init(gpio_flash_init); 287 - 288 - static void __exit gpio_flash_exit(void) 289 - { 290 - platform_driver_unregister(&gpio_flash_driver); 291 - } 292 - module_exit(gpio_flash_exit); 282 + module_platform_driver(gpio_flash_driver); 293 283 294 284 MODULE_AUTHOR("Mike Frysinger <vapier@gentoo.org>"); 295 285 MODULE_DESCRIPTION("MTD map driver for flashes addressed physically and with gpios");
+1 -11
drivers/mtd/maps/ixp2000.c
··· 246 246 }, 247 247 }; 248 248 249 - static int __init ixp2000_flash_init(void) 250 - { 251 - return platform_driver_register(&ixp2000_flash_driver); 252 - } 249 + module_platform_driver(ixp2000_flash_driver); 253 250 254 - static void __exit ixp2000_flash_exit(void) 255 - { 256 - platform_driver_unregister(&ixp2000_flash_driver); 257 - } 258 - 259 - module_init(ixp2000_flash_init); 260 - module_exit(ixp2000_flash_exit); 261 251 MODULE_LICENSE("GPL"); 262 252 MODULE_AUTHOR("Deepak Saxena <dsaxena@plexity.net>"); 263 253 MODULE_ALIAS("platform:IXP2000-Flash");
+1 -13
drivers/mtd/maps/ixp4xx.c
··· 270 270 }, 271 271 }; 272 272 273 - static int __init ixp4xx_flash_init(void) 274 - { 275 - return platform_driver_register(&ixp4xx_flash_driver); 276 - } 277 - 278 - static void __exit ixp4xx_flash_exit(void) 279 - { 280 - platform_driver_unregister(&ixp4xx_flash_driver); 281 - } 282 - 283 - 284 - module_init(ixp4xx_flash_init); 285 - module_exit(ixp4xx_flash_exit); 273 + module_platform_driver(ixp4xx_flash_driver); 286 274 287 275 MODULE_LICENSE("GPL"); 288 276 MODULE_DESCRIPTION("MTD map driver for Intel IXP4xx systems");
+1 -11
drivers/mtd/maps/latch-addr-flash.c
··· 223 223 }, 224 224 }; 225 225 226 - static int __init latch_addr_flash_init(void) 227 - { 228 - return platform_driver_register(&latch_addr_flash_driver); 229 - } 230 - module_init(latch_addr_flash_init); 231 - 232 - static void __exit latch_addr_flash_exit(void) 233 - { 234 - platform_driver_unregister(&latch_addr_flash_driver); 235 - } 236 - module_exit(latch_addr_flash_exit); 226 + module_platform_driver(latch_addr_flash_driver); 237 227 238 228 MODULE_AUTHOR("David Griego <dgriego@mvista.com>"); 239 229 MODULE_DESCRIPTION("MTD map driver for flashes addressed physically with upper "
+1 -12
drivers/mtd/maps/physmap_of.c
··· 338 338 .remove = of_flash_remove, 339 339 }; 340 340 341 - static int __init of_flash_init(void) 342 - { 343 - return platform_driver_register(&of_flash_driver); 344 - } 345 - 346 - static void __exit of_flash_exit(void) 347 - { 348 - platform_driver_unregister(&of_flash_driver); 349 - } 350 - 351 - module_init(of_flash_init); 352 - module_exit(of_flash_exit); 341 + module_platform_driver(of_flash_driver); 353 342 354 343 MODULE_LICENSE("GPL"); 355 344 MODULE_AUTHOR("Vitaly Wool <vwool@ru.mvista.com>");
+1 -12
drivers/mtd/maps/pxa2xx-flash.c
··· 142 142 .shutdown = pxa2xx_flash_shutdown, 143 143 }; 144 144 145 - static int __init init_pxa2xx_flash(void) 146 - { 147 - return platform_driver_register(&pxa2xx_flash_driver); 148 - } 149 - 150 - static void __exit cleanup_pxa2xx_flash(void) 151 - { 152 - platform_driver_unregister(&pxa2xx_flash_driver); 153 - } 154 - 155 - module_init(init_pxa2xx_flash); 156 - module_exit(cleanup_pxa2xx_flash); 145 + module_platform_driver(pxa2xx_flash_driver); 157 146 158 147 MODULE_LICENSE("GPL"); 159 148 MODULE_AUTHOR("Nicolas Pitre <nico@fluxnic.net>");
+1 -12
drivers/mtd/maps/rbtx4939-flash.c
··· 137 137 }, 138 138 }; 139 139 140 - static int __init rbtx4939_flash_init(void) 141 - { 142 - return platform_driver_register(&rbtx4939_flash_driver); 143 - } 144 - 145 - static void __exit rbtx4939_flash_exit(void) 146 - { 147 - platform_driver_unregister(&rbtx4939_flash_driver); 148 - } 149 - 150 - module_init(rbtx4939_flash_init); 151 - module_exit(rbtx4939_flash_exit); 140 + module_platform_driver(rbtx4939_flash_driver); 152 141 153 142 MODULE_LICENSE("GPL"); 154 143 MODULE_DESCRIPTION("RBTX4939 MTD map driver");
+1 -12
drivers/mtd/maps/sa1100-flash.c
··· 394 394 }, 395 395 }; 396 396 397 - static int __init sa1100_mtd_init(void) 398 - { 399 - return platform_driver_register(&sa1100_mtd_driver); 400 - } 401 - 402 - static void __exit sa1100_mtd_exit(void) 403 - { 404 - platform_driver_unregister(&sa1100_mtd_driver); 405 - } 406 - 407 - module_init(sa1100_mtd_init); 408 - module_exit(sa1100_mtd_exit); 397 + module_platform_driver(sa1100_mtd_driver); 409 398 410 399 MODULE_AUTHOR("Nicolas Pitre"); 411 400 MODULE_DESCRIPTION("SA1100 CFI map driver");
+1 -12
drivers/mtd/maps/sun_uflash.c
··· 158 158 .remove = __devexit_p(uflash_remove), 159 159 }; 160 160 161 - static int __init uflash_init(void) 162 - { 163 - return platform_driver_register(&uflash_driver); 164 - } 165 - 166 - static void __exit uflash_exit(void) 167 - { 168 - platform_driver_unregister(&uflash_driver); 169 - } 170 - 171 - module_init(uflash_init); 172 - module_exit(uflash_exit); 161 + module_platform_driver(uflash_driver);
+1 -11
drivers/mtd/nand/ams-delta.c
··· 280 280 }, 281 281 }; 282 282 283 - static int __init ams_delta_nand_init(void) 284 - { 285 - return platform_driver_register(&ams_delta_nand_driver); 286 - } 287 - module_init(ams_delta_nand_init); 288 - 289 - static void __exit ams_delta_nand_exit(void) 290 - { 291 - platform_driver_unregister(&ams_delta_nand_driver); 292 - } 293 - module_exit(ams_delta_nand_exit); 283 + module_platform_driver(ams_delta_nand_driver); 294 284 295 285 MODULE_LICENSE("GPL"); 296 286 MODULE_AUTHOR("Jonathan McDowell <noodles@earth.li>");
+1 -12
drivers/mtd/nand/bcm_umi_nand.c
··· 546 546 .resume = bcm_umi_nand_resume, 547 547 }; 548 548 549 - static int __init nand_init(void) 550 - { 551 - return platform_driver_register(&nand_driver); 552 - } 553 - 554 - static void __exit nand_exit(void) 555 - { 556 - platform_driver_unregister(&nand_driver); 557 - } 558 - 559 - module_init(nand_init); 560 - module_exit(nand_exit); 549 + module_platform_driver(nand_driver); 561 550 562 551 MODULE_LICENSE("GPL"); 563 552 MODULE_AUTHOR("Broadcom");
+1 -12
drivers/mtd/nand/fsl_elbc_nand.c
··· 971 971 .remove = fsl_elbc_nand_remove, 972 972 }; 973 973 974 - static int __init fsl_elbc_nand_init(void) 975 - { 976 - return platform_driver_register(&fsl_elbc_nand_driver); 977 - } 978 - 979 - static void __exit fsl_elbc_nand_exit(void) 980 - { 981 - platform_driver_unregister(&fsl_elbc_nand_driver); 982 - } 983 - 984 - module_init(fsl_elbc_nand_init); 985 - module_exit(fsl_elbc_nand_exit); 974 + module_platform_driver(fsl_elbc_nand_driver); 986 975 987 976 MODULE_LICENSE("GPL"); 988 977 MODULE_AUTHOR("Freescale");
+1 -11
drivers/mtd/nand/fsl_upm.c
··· 353 353 .remove = __devexit_p(fun_remove), 354 354 }; 355 355 356 - static int __init fun_module_init(void) 357 - { 358 - return platform_driver_register(&of_fun_driver); 359 - } 360 - module_init(fun_module_init); 361 - 362 - static void __exit fun_module_exit(void) 363 - { 364 - platform_driver_unregister(&of_fun_driver); 365 - } 366 - module_exit(fun_module_exit); 356 + module_platform_driver(of_fun_driver); 367 357 368 358 MODULE_LICENSE("GPL"); 369 359 MODULE_AUTHOR("Anton Vorontsov <avorontsov@ru.mvista.com>");
+1 -11
drivers/mtd/nand/jz4740_nand.c
··· 423 423 }, 424 424 }; 425 425 426 - static int __init jz_nand_init(void) 427 - { 428 - return platform_driver_register(&jz_nand_driver); 429 - } 430 - module_init(jz_nand_init); 431 - 432 - static void __exit jz_nand_exit(void) 433 - { 434 - platform_driver_unregister(&jz_nand_driver); 435 - } 436 - module_exit(jz_nand_exit); 426 + module_platform_driver(jz_nand_driver); 437 427 438 428 MODULE_LICENSE("GPL"); 439 429 MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
+1 -13
drivers/mtd/nand/mpc5121_nfc.c
··· 879 879 }, 880 880 }; 881 881 882 - static int __init mpc5121_nfc_init(void) 883 - { 884 - return platform_driver_register(&mpc5121_nfc_driver); 885 - } 886 - 887 - module_init(mpc5121_nfc_init); 888 - 889 - static void __exit mpc5121_nfc_cleanup(void) 890 - { 891 - platform_driver_unregister(&mpc5121_nfc_driver); 892 - } 893 - 894 - module_exit(mpc5121_nfc_cleanup); 882 + module_platform_driver(mpc5121_nfc_driver); 895 883 896 884 MODULE_AUTHOR("Freescale Semiconductor, Inc."); 897 885 MODULE_DESCRIPTION("MPC5121 NAND MTD driver");
+1 -12
drivers/mtd/nand/ndfc.c
··· 294 294 .remove = __devexit_p(ndfc_remove), 295 295 }; 296 296 297 - static int __init ndfc_nand_init(void) 298 - { 299 - return platform_driver_register(&ndfc_driver); 300 - } 301 - 302 - static void __exit ndfc_nand_exit(void) 303 - { 304 - platform_driver_unregister(&ndfc_driver); 305 - } 306 - 307 - module_init(ndfc_nand_init); 308 - module_exit(ndfc_nand_exit); 297 + module_platform_driver(ndfc_driver); 309 298 310 299 MODULE_LICENSE("GPL"); 311 300 MODULE_AUTHOR("Thomas Gleixner <tglx@linutronix.de>");
+1 -13
drivers/mtd/nand/nomadik_nand.c
··· 228 228 }, 229 229 }; 230 230 231 - static int __init nand_nomadik_init(void) 232 - { 233 - pr_info("Nomadik NAND driver\n"); 234 - return platform_driver_register(&nomadik_nand_driver); 235 - } 236 - 237 - static void __exit nand_nomadik_exit(void) 238 - { 239 - platform_driver_unregister(&nomadik_nand_driver); 240 - } 241 - 242 - module_init(nand_nomadik_init); 243 - module_exit(nand_nomadik_exit); 231 + module_platform_driver(nomadik_nand_driver); 244 232 245 233 MODULE_LICENSE("GPL"); 246 234 MODULE_AUTHOR("ST Microelectronics (sachin.verma@st.com)");
+1 -12
drivers/mtd/nand/nuc900_nand.c
··· 364 364 }, 365 365 }; 366 366 367 - static int __init nuc900_nand_init(void) 368 - { 369 - return platform_driver_register(&nuc900_nand_driver); 370 - } 371 - 372 - static void __exit nuc900_nand_exit(void) 373 - { 374 - platform_driver_unregister(&nuc900_nand_driver); 375 - } 376 - 377 - module_init(nuc900_nand_init); 378 - module_exit(nuc900_nand_exit); 367 + module_platform_driver(nuc900_nand_driver); 379 368 380 369 MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>"); 381 370 MODULE_DESCRIPTION("w90p910/NUC9xx nand driver!");
+1 -14
drivers/mtd/nand/omap2.c
··· 1145 1145 }, 1146 1146 }; 1147 1147 1148 - static int __init omap_nand_init(void) 1149 - { 1150 - pr_info("%s driver initializing\n", DRIVER_NAME); 1151 - 1152 - return platform_driver_register(&omap_nand_driver); 1153 - } 1154 - 1155 - static void __exit omap_nand_exit(void) 1156 - { 1157 - platform_driver_unregister(&omap_nand_driver); 1158 - } 1159 - 1160 - module_init(omap_nand_init); 1161 - module_exit(omap_nand_exit); 1148 + module_platform_driver(omap_nand_driver); 1162 1149 1163 1150 MODULE_ALIAS("platform:" DRIVER_NAME); 1164 1151 MODULE_LICENSE("GPL");
+1 -11
drivers/mtd/nand/pasemi_nand.c
··· 230 230 .remove = pasemi_nand_remove, 231 231 }; 232 232 233 - static int __init pasemi_nand_init(void) 234 - { 235 - return platform_driver_register(&pasemi_nand_driver); 236 - } 237 - module_init(pasemi_nand_init); 238 - 239 - static void __exit pasemi_nand_exit(void) 240 - { 241 - platform_driver_unregister(&pasemi_nand_driver); 242 - } 243 - module_exit(pasemi_nand_exit); 233 + module_platform_driver(pasemi_nand_driver); 244 234 245 235 MODULE_LICENSE("GPL"); 246 236 MODULE_AUTHOR("Egor Martovetsky <egor@pasemi.com>");
+1 -12
drivers/mtd/nand/plat_nand.c
··· 148 148 }, 149 149 }; 150 150 151 - static int __init plat_nand_init(void) 152 - { 153 - return platform_driver_register(&plat_nand_driver); 154 - } 155 - 156 - static void __exit plat_nand_exit(void) 157 - { 158 - platform_driver_unregister(&plat_nand_driver); 159 - } 160 - 161 - module_init(plat_nand_init); 162 - module_exit(plat_nand_exit); 151 + module_platform_driver(plat_nand_driver); 163 152 164 153 MODULE_LICENSE("GPL"); 165 154 MODULE_AUTHOR("Vitaly Wool");
+1 -11
drivers/mtd/nand/pxa3xx_nand.c
··· 1311 1311 .resume = pxa3xx_nand_resume, 1312 1312 }; 1313 1313 1314 - static int __init pxa3xx_nand_init(void) 1315 - { 1316 - return platform_driver_register(&pxa3xx_nand_driver); 1317 - } 1318 - module_init(pxa3xx_nand_init); 1319 - 1320 - static void __exit pxa3xx_nand_exit(void) 1321 - { 1322 - platform_driver_unregister(&pxa3xx_nand_driver); 1323 - } 1324 - module_exit(pxa3xx_nand_exit); 1314 + module_platform_driver(pxa3xx_nand_driver); 1325 1315 1326 1316 MODULE_LICENSE("GPL"); 1327 1317 MODULE_DESCRIPTION("PXA3xx NAND controller driver");
+1 -11
drivers/mtd/nand/sharpsl.c
··· 230 230 .remove = __devexit_p(sharpsl_nand_remove), 231 231 }; 232 232 233 - static int __init sharpsl_nand_init(void) 234 - { 235 - return platform_driver_register(&sharpsl_nand_driver); 236 - } 237 - module_init(sharpsl_nand_init); 238 - 239 - static void __exit sharpsl_nand_exit(void) 240 - { 241 - platform_driver_unregister(&sharpsl_nand_driver); 242 - } 243 - module_exit(sharpsl_nand_exit); 233 + module_platform_driver(sharpsl_nand_driver); 244 234 245 235 MODULE_LICENSE("GPL"); 246 236 MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>");
+1 -12
drivers/mtd/nand/socrates_nand.c
··· 273 273 .remove = __devexit_p(socrates_nand_remove), 274 274 }; 275 275 276 - static int __init socrates_nand_init(void) 277 - { 278 - return platform_driver_register(&socrates_nand_driver); 279 - } 280 - 281 - static void __exit socrates_nand_exit(void) 282 - { 283 - platform_driver_unregister(&socrates_nand_driver); 284 - } 285 - 286 - module_init(socrates_nand_init); 287 - module_exit(socrates_nand_exit); 276 + module_platform_driver(socrates_nand_driver); 288 277 289 278 MODULE_LICENSE("GPL"); 290 279 MODULE_AUTHOR("Ilya Yanok");
+1 -12
drivers/mtd/nand/tmio_nand.c
··· 533 533 .resume = tmio_resume, 534 534 }; 535 535 536 - static int __init tmio_init(void) 537 - { 538 - return platform_driver_register(&tmio_driver); 539 - } 540 - 541 - static void __exit tmio_exit(void) 542 - { 543 - platform_driver_unregister(&tmio_driver); 544 - } 545 - 546 - module_init(tmio_init); 547 - module_exit(tmio_exit); 536 + module_platform_driver(tmio_driver); 548 537 549 538 MODULE_LICENSE("GPL v2"); 550 539 MODULE_AUTHOR("Ian Molton, Dirk Opfer, Chris Humbert, Dmitry Baryshkov");
+2 -14
drivers/mtd/onenand/generic.c
··· 115 115 .remove = __devexit_p(generic_onenand_remove), 116 116 }; 117 117 118 - MODULE_ALIAS("platform:" DRIVER_NAME); 119 - 120 - static int __init generic_onenand_init(void) 121 - { 122 - return platform_driver_register(&generic_onenand_driver); 123 - } 124 - 125 - static void __exit generic_onenand_exit(void) 126 - { 127 - platform_driver_unregister(&generic_onenand_driver); 128 - } 129 - 130 - module_init(generic_onenand_init); 131 - module_exit(generic_onenand_exit); 118 + module_platform_driver(generic_onenand_driver); 132 119 133 120 MODULE_LICENSE("GPL"); 134 121 MODULE_AUTHOR("Kyungmin Park <kyungmin.park@samsung.com>"); 135 122 MODULE_DESCRIPTION("Glue layer for OneNAND flash on generic boards"); 123 + MODULE_ALIAS("platform:" DRIVER_NAME);
+1 -12
drivers/mtd/onenand/samsung.c
··· 1133 1133 .remove = __devexit_p(s3c_onenand_remove), 1134 1134 }; 1135 1135 1136 - static int __init s3c_onenand_init(void) 1137 - { 1138 - return platform_driver_register(&s3c_onenand_driver); 1139 - } 1140 - 1141 - static void __exit s3c_onenand_exit(void) 1142 - { 1143 - platform_driver_unregister(&s3c_onenand_driver); 1144 - } 1145 - 1146 - module_init(s3c_onenand_init); 1147 - module_exit(s3c_onenand_exit); 1136 + module_platform_driver(s3c_onenand_driver); 1148 1137 1149 1138 MODULE_LICENSE("GPL"); 1150 1139 MODULE_AUTHOR("Kyungmin Park <kyungmin.park@samsung.com>");