xref: /linux/drivers/mtd/mtdcore.h (revision a1c613ae4c322ddd58d5a8539dbfba2a0380a8c0)
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;
80f071004SDavid Howells extern struct backing_dev_info *mtd_bdi;
9f1332ba2SBen Hutchings 
10cb70783cSArtem Bityutskiy struct mtd_info *__mtd_next_device(int i);
112b6f0090SBoris Brezillon int __must_check add_mtd_device(struct mtd_info *mtd);
12cb70783cSArtem Bityutskiy int del_mtd_device(struct mtd_info *mtd);
13cb70783cSArtem Bityutskiy int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int);
14cb70783cSArtem Bityutskiy int del_mtd_partitions(struct mtd_info *);
15*19bfa9ebSTomas Winkler void release_mtd_partition(struct mtd_info *mtd);
1607fd2f87SBrian Norris 
1707fd2f87SBrian Norris struct mtd_partitions;
1807fd2f87SBrian Norris 
19cb70783cSArtem Bityutskiy int parse_mtd_partitions(struct mtd_info *master, const char * const *types,
203165f44bSDmitry Eremin-Solenikov 			 struct mtd_part_parser_data *data);
21eea72d5fSJamie Iles 
22adc83bf8SBrian Norris void mtd_part_parser_cleanup(struct mtd_partitions *parts);
23adc83bf8SBrian Norris 
24660685d9SArtem Bityutskiy int __init init_mtdchar(void);
25660685d9SArtem Bityutskiy void __exit cleanup_mtdchar(void);
26660685d9SArtem Bityutskiy 
27f1332ba2SBen Hutchings #define mtd_for_each_device(mtd)			\
28f1332ba2SBen Hutchings 	for ((mtd) = __mtd_next_device(0);		\
29f1332ba2SBen Hutchings 	     (mtd) != NULL;				\
30f1332ba2SBen Hutchings 	     (mtd) = __mtd_next_device(mtd->index + 1))
31