mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-05 10:04:12 +08:00
adc83bf889
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>
29 lines
876 B
C
29 lines
876 B
C
/*
|
|
* These are exported solely for the purpose of mtd_blkdevs.c and mtdchar.c.
|
|
* You should not use them for _anything_ else.
|
|
*/
|
|
|
|
extern struct mutex mtd_table_mutex;
|
|
|
|
struct mtd_info *__mtd_next_device(int i);
|
|
int add_mtd_device(struct mtd_info *mtd);
|
|
int del_mtd_device(struct mtd_info *mtd);
|
|
int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int);
|
|
int del_mtd_partitions(struct mtd_info *);
|
|
|
|
struct mtd_partitions;
|
|
|
|
int parse_mtd_partitions(struct mtd_info *master, const char * const *types,
|
|
struct mtd_partitions *pparts,
|
|
struct mtd_part_parser_data *data);
|
|
|
|
void mtd_part_parser_cleanup(struct mtd_partitions *parts);
|
|
|
|
int __init init_mtdchar(void);
|
|
void __exit cleanup_mtdchar(void);
|
|
|
|
#define mtd_for_each_device(mtd) \
|
|
for ((mtd) = __mtd_next_device(0); \
|
|
(mtd) != NULL; \
|
|
(mtd) = __mtd_next_device(mtd->index + 1))
|