xref: /linux/drivers/mtd/mtdcore.h (revision b24413180f5600bcb3bb70fbed5cf186b60864bd)
1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2cb70783cSArtem Bityutskiy /*
3660685d9SArtem Bityutskiy  * These are exported solely for the purpose of mtd_blkdevs.c and mtdchar.c.
4660685d9SArtem Bityutskiy  * You should not use them for _anything_ else.
5356d70f1SBen Dooks  */
6356d70f1SBen Dooks 
7356d70f1SBen Dooks extern struct mutex mtd_table_mutex;
8f1332ba2SBen Hutchings 
9cb70783cSArtem Bityutskiy struct mtd_info *__mtd_next_device(int i);
10cb70783cSArtem Bityutskiy int add_mtd_device(struct mtd_info *mtd);
11cb70783cSArtem Bityutskiy int del_mtd_device(struct mtd_info *mtd);
12cb70783cSArtem Bityutskiy int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int);
13cb70783cSArtem Bityutskiy int del_mtd_partitions(struct mtd_info *);
1407fd2f87SBrian Norris 
1507fd2f87SBrian Norris struct mtd_partitions;
1607fd2f87SBrian Norris 
17cb70783cSArtem Bityutskiy int parse_mtd_partitions(struct mtd_info *master, const char * const *types,
1807fd2f87SBrian Norris 			 struct mtd_partitions *pparts,
193165f44bSDmitry Eremin-Solenikov 			 struct mtd_part_parser_data *data);
20eea72d5fSJamie Iles 
21adc83bf8SBrian Norris void mtd_part_parser_cleanup(struct mtd_partitions *parts);
22adc83bf8SBrian Norris 
23660685d9SArtem Bityutskiy int __init init_mtdchar(void);
24660685d9SArtem Bityutskiy void __exit cleanup_mtdchar(void);
25660685d9SArtem Bityutskiy 
26f1332ba2SBen Hutchings #define mtd_for_each_device(mtd)			\
27f1332ba2SBen Hutchings 	for ((mtd) = __mtd_next_device(0);		\
28f1332ba2SBen Hutchings 	     (mtd) != NULL;				\
29f1332ba2SBen Hutchings 	     (mtd) = __mtd_next_device(mtd->index + 1))
30