From b8f70badb8cd7c928f7e076b6143aeb66fe13c8b Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Wed, 11 Nov 2015 19:13:30 -0800 Subject: mtd: kill off MTD partition parser boilerplate 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 --- drivers/mtd/bcm47xxpart.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'drivers/mtd/bcm47xxpart.c') diff --git a/drivers/mtd/bcm47xxpart.c b/drivers/mtd/bcm47xxpart.c index c0720c1..92a6dd1 100644 --- a/drivers/mtd/bcm47xxpart.c +++ b/drivers/mtd/bcm47xxpart.c @@ -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"); -- cgit v1.1 From b9adf469f8abb8a66f5795bbd8fe50fe201a14a1 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Fri, 4 Dec 2015 15:25:14 -0800 Subject: mtd: partitions: make parsers return 'const' partition arrays We only want to modify these arrays inside the parser "drivers", so the drivers should construct them however they like, then return them as immutable arrays. This will make other refactorings easier. Signed-off-by: Brian Norris Reviewed-by: Boris Brezillon --- drivers/mtd/bcm47xxpart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/mtd/bcm47xxpart.c') diff --git a/drivers/mtd/bcm47xxpart.c b/drivers/mtd/bcm47xxpart.c index 92a6dd1..8282f47 100644 --- a/drivers/mtd/bcm47xxpart.c +++ b/drivers/mtd/bcm47xxpart.c @@ -82,7 +82,7 @@ out_default: } static int bcm47xxpart_parse(struct mtd_info *master, - struct mtd_partition **pparts, + const struct mtd_partition **pparts, struct mtd_part_parser_data *data) { struct mtd_partition *parts; -- cgit v1.1