diff options
author | Brian Norris <computersforpeace@gmail.com> | 2015-11-11 19:13:29 -0800 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2015-11-19 18:46:28 -0800 |
commit | b9eab01125bf3cb6f5fbab1811402d16c9fcf4ec (patch) | |
tree | 8f117ec9783e121e50b16d7601dc10254a268b01 /drivers/mtd/mtdpart.c | |
parent | 1d158315c13b6989f7ddb1d8d334965d14d958d8 (diff) |
mtd: partitions: add module_mtd_part_parser() helper
This can help eliminate some boilerplate by generating the module_init()
and module_exit() functions, and by automatically assigning the module
owner.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd/mtdpart.c')
-rw-r--r-- | drivers/mtd/mtdpart.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 46dfbf5629c3..1fa3ca95d9c1 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c @@ -703,13 +703,17 @@ static struct mtd_part_parser *get_partition_parser(const char *name) #define put_partition_parser(p) do { module_put((p)->owner); } while (0) -void register_mtd_parser(struct mtd_part_parser *p) +int __register_mtd_parser(struct mtd_part_parser *p, struct module *owner) { + p->owner = owner; + spin_lock(&part_parser_lock); list_add(&p->list, &part_parsers); spin_unlock(&part_parser_lock); + + return 0; } -EXPORT_SYMBOL_GPL(register_mtd_parser); +EXPORT_SYMBOL_GPL(__register_mtd_parser); void deregister_mtd_parser(struct mtd_part_parser *p) { |