]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
mtd: kill off MTD partition parser boilerplate
authorBrian Norris <computersforpeace@gmail.com>
Thu, 12 Nov 2015 03:13:30 +0000 (19:13 -0800)
committerBrian Norris <computersforpeace@gmail.com>
Fri, 20 Nov 2015 02:46:29 +0000 (18:46 -0800)
Most parsers can be handled with our new boilerplate-reducing macro.
There are a few that can't be (cmdlineparts and ofpart).

Also kill off the owner assignments, since register_mtd_parser() now
takes care of that.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/afs.c
drivers/mtd/ar7part.c
drivers/mtd/bcm47xxpart.c
drivers/mtd/bcm63xxpart.c
drivers/mtd/cmdlinepart.c
drivers/mtd/ofpart.c
drivers/mtd/redboot.c

index a1eea50ce180075affd19786ca364fbd497dfe15..e02dae3b739bd0b7068711e09fd6ce2595866812 100644 (file)
@@ -256,25 +256,10 @@ static int parse_afs_partitions(struct mtd_info *mtd,
 }
 
 static struct mtd_part_parser afs_parser = {
-       .owner = THIS_MODULE,
        .parse_fn = parse_afs_partitions,
        .name = "afs",
 };
-
-static int __init afs_parser_init(void)
-{
-       register_mtd_parser(&afs_parser);
-       return 0;
-}
-
-static void __exit afs_parser_exit(void)
-{
-       deregister_mtd_parser(&afs_parser);
-}
-
-module_init(afs_parser_init);
-module_exit(afs_parser_exit);
-
+module_mtd_part_parser(afs_parser);
 
 MODULE_AUTHOR("ARM Ltd");
 MODULE_DESCRIPTION("ARM Firmware Suite partition parser");
index 7c9172ad26210e1d25c9506889e0cbb54212dbfe..9203b96fd78922ef9a004017c1cb11fd553d45af 100644 (file)
@@ -132,24 +132,10 @@ static int create_mtd_partitions(struct mtd_info *master,
 }
 
 static struct mtd_part_parser ar7_parser = {
-       .owner = THIS_MODULE,
        .parse_fn = create_mtd_partitions,
        .name = "ar7part",
 };
-
-static int __init ar7_parser_init(void)
-{
-       register_mtd_parser(&ar7_parser);
-       return 0;
-}
-
-static void __exit ar7_parser_exit(void)
-{
-       deregister_mtd_parser(&ar7_parser);
-}
-
-module_init(ar7_parser_init);
-module_exit(ar7_parser_exit);
+module_mtd_part_parser(ar7_parser);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR( "Felix Fietkau <nbd@openwrt.org>, "
index c0720c1ee4c9607d0887e7b4caacecdac96088af..92a6dd18198be44d98cda2bf7b84559ba15a310d 100644 (file)
@@ -313,24 +313,10 @@ static int bcm47xxpart_parse(struct mtd_info *master,
 };
 
 static struct mtd_part_parser bcm47xxpart_mtd_parser = {
-       .owner = THIS_MODULE,
        .parse_fn = bcm47xxpart_parse,
        .name = "bcm47xxpart",
 };
-
-static int __init bcm47xxpart_init(void)
-{
-       register_mtd_parser(&bcm47xxpart_mtd_parser);
-       return 0;
-}
-
-static void __exit bcm47xxpart_exit(void)
-{
-       deregister_mtd_parser(&bcm47xxpart_mtd_parser);
-}
-
-module_init(bcm47xxpart_init);
-module_exit(bcm47xxpart_exit);
+module_mtd_part_parser(bcm47xxpart_mtd_parser);
 
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("MTD partitioning for BCM47XX flash memories");
index b2443f7031c9afb0bda808a37b6da7e8113d0a61..cf02135320bce5f41c60a0a43f60061d042063dc 100644 (file)
@@ -214,24 +214,10 @@ static int bcm63xx_parse_cfe_partitions(struct mtd_info *master,
 };
 
 static struct mtd_part_parser bcm63xx_cfe_parser = {
-       .owner = THIS_MODULE,
        .parse_fn = bcm63xx_parse_cfe_partitions,
        .name = "bcm63xxpart",
 };
-
-static int __init bcm63xx_cfe_parser_init(void)
-{
-       register_mtd_parser(&bcm63xx_cfe_parser);
-       return 0;
-}
-
-static void __exit bcm63xx_cfe_parser_exit(void)
-{
-       deregister_mtd_parser(&bcm63xx_cfe_parser);
-}
-
-module_init(bcm63xx_cfe_parser_init);
-module_exit(bcm63xx_cfe_parser_exit);
+module_mtd_part_parser(bcm63xx_cfe_parser);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Daniel Dickinson <openwrt@cshore.neomailbox.net>");
index 08f62987cc37c4f02e7bf359806c802d9a601119..420489864bc2d2a4243b705391050f1ebe6d9a2d 100644 (file)
@@ -382,7 +382,6 @@ static int __init mtdpart_setup(char *s)
 __setup("mtdparts=", mtdpart_setup);
 
 static struct mtd_part_parser cmdline_parser = {
-       .owner = THIS_MODULE,
        .parse_fn = parse_cmdline_partitions,
        .name = "cmdlinepart",
 };
index f78d2aea5545e8660b6c1808b3a5624717d95a0a..478538100ddd953eda73bc1da7bb8e43d90a1683 100644 (file)
@@ -131,7 +131,6 @@ ofpart_none:
 }
 
 static struct mtd_part_parser ofpart_parser = {
-       .owner = THIS_MODULE,
        .parse_fn = parse_ofpart_partitions,
        .name = "ofpart",
 };
@@ -191,7 +190,6 @@ static int parse_ofoldpart_partitions(struct mtd_info *master,
 }
 
 static struct mtd_part_parser ofoldpart_parser = {
-       .owner = THIS_MODULE,
        .parse_fn = parse_ofoldpart_partitions,
        .name = "ofoldpart",
 };
index 5da911ebdf495152c68c52af72d0784f0a8ede54..11c3447eb8ff78555ac9d1c0780d14b79a8d73b1 100644 (file)
@@ -290,28 +290,13 @@ static int parse_redboot_partitions(struct mtd_info *master,
 }
 
 static struct mtd_part_parser redboot_parser = {
-       .owner = THIS_MODULE,
        .parse_fn = parse_redboot_partitions,
        .name = "RedBoot",
 };
+module_mtd_part_parser(redboot_parser);
 
 /* mtd parsers will request the module by parser name */
 MODULE_ALIAS("RedBoot");
-
-static int __init redboot_parser_init(void)
-{
-       register_mtd_parser(&redboot_parser);
-       return 0;
-}
-
-static void __exit redboot_parser_exit(void)
-{
-       deregister_mtd_parser(&redboot_parser);
-}
-
-module_init(redboot_parser_init);
-module_exit(redboot_parser_exit);
-
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");
 MODULE_DESCRIPTION("Parsing code for RedBoot Flash Image System (FIS) tables");