diff options
author | Brian Norris <computersforpeace@gmail.com> | 2015-12-09 13:24:03 -0500 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2015-12-09 17:57:44 -0500 |
commit | adc83bf8896353603213754353dd66dae69e3d7f (patch) | |
tree | 30c186e19aa8a5f92117cce23c43dc840e19c699 /include/linux/mtd | |
parent | 07fd2f871c5e3dfb8ff5eb9c4b44fdb4cf1aeff5 (diff) |
mtd: partitions: support a cleanup callback for parsers
If partition parsers need to clean up their resources, we shouldn't
assume that all memory will fit in a single kmalloc() that the caller
can kfree(). We should allow the parser to provide a proper cleanup
routine.
Note that this means we need to keep a hold on the parser's module for a
bit longer, and release it later with mtd_part_parser_put().
Alongside this, define a default callback that we'll automatically use
if the parser doesn't provide one, so we can still retain the old
behavior.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Diffstat (limited to 'include/linux/mtd')
-rw-r--r-- | include/linux/mtd/partitions.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h index cceaf7bd1537..70736e1e6c8f 100644 --- a/include/linux/mtd/partitions.h +++ b/include/linux/mtd/partitions.h | |||
@@ -71,6 +71,7 @@ struct mtd_part_parser { | |||
71 | const char *name; | 71 | const char *name; |
72 | int (*parse_fn)(struct mtd_info *, const struct mtd_partition **, | 72 | int (*parse_fn)(struct mtd_info *, const struct mtd_partition **, |
73 | struct mtd_part_parser_data *); | 73 | struct mtd_part_parser_data *); |
74 | void (*cleanup)(const struct mtd_partition *pparts, int nr_parts); | ||
74 | }; | 75 | }; |
75 | 76 | ||
76 | /* Container for passing around a set of parsed partitions */ | 77 | /* Container for passing around a set of parsed partitions */ |