diff options
author | Brian Norris <computersforpeace@gmail.com> | 2015-11-12 03:13:29 (GMT) |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2015-11-20 02:46:28 (GMT) |
commit | b9eab01125bf3cb6f5fbab1811402d16c9fcf4ec (patch) | |
tree | 8f117ec9783e121e50b16d7601dc10254a268b01 /drivers/mtd | |
parent | 1d158315c13b6989f7ddb1d8d334965d14d958d8 (diff) | |
download | linux-b9eab01125bf3cb6f5fbab1811402d16c9fcf4ec.tar.xz |
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')
-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 46dfbf5..1fa3ca9 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) { |