xref: /linux/drivers/mtd/mtdcore.h (revision 2b6f0090a3335b7bdd03ca520c35591159463041)
1b2441318SGreg 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);
10*2b6f0090SBoris Brezillon int __must_check 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,
183165f44bSDmitry Eremin-Solenikov 			 struct mtd_part_parser_data *data);
19eea72d5fSJamie Iles 
20adc83bf8SBrian Norris void mtd_part_parser_cleanup(struct mtd_partitions *parts);
21adc83bf8SBrian Norris 
22660685d9SArtem Bityutskiy int __init init_mtdchar(void);
23660685d9SArtem Bityutskiy void __exit cleanup_mtdchar(void);
24660685d9SArtem Bityutskiy 
25f1332ba2SBen Hutchings #define mtd_for_each_device(mtd)			\
26f1332ba2SBen Hutchings 	for ((mtd) = __mtd_next_device(0);		\
27f1332ba2SBen Hutchings 	     (mtd) != NULL;				\
28f1332ba2SBen Hutchings 	     (mtd) = __mtd_next_device(mtd->index + 1))
29