xref: /openbmc/u-boot/drivers/mtd/ubi/wl.h (revision 282ce645)
1 #ifndef UBI_WL_H
2 #define UBI_WL_H
3 #ifdef CONFIG_MTD_UBI_FASTMAP
4 static int anchor_pebs_avalible(struct rb_root *root);
5 #ifndef __UBOOT__
6 static void update_fastmap_work_fn(struct work_struct *wrk);
7 #else
8 void update_fastmap_work_fn(struct ubi_device *ubi);
9 #endif
10 static struct ubi_wl_entry *find_anchor_wl_entry(struct rb_root *root);
11 static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi);
12 static void ubi_fastmap_close(struct ubi_device *ubi);
13 static inline void ubi_fastmap_init(struct ubi_device *ubi, int *count)
14 {
15 	/* Reserve enough LEBs to store two fastmaps. */
16 	*count += (ubi->fm_size / ubi->leb_size) * 2;
17 #ifndef __UBOOT__
18 	INIT_WORK(&ubi->fm_work, update_fastmap_work_fn);
19 #endif
20 }
21 static struct ubi_wl_entry *may_reserve_for_fm(struct ubi_device *ubi,
22 					       struct ubi_wl_entry *e,
23 					       struct rb_root *root);
24 #else /* !CONFIG_MTD_UBI_FASTMAP */
25 static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi);
26 static inline void ubi_fastmap_close(struct ubi_device *ubi) { }
27 static inline void ubi_fastmap_init(struct ubi_device *ubi, int *count) { }
28 static struct ubi_wl_entry *may_reserve_for_fm(struct ubi_device *ubi,
29 					       struct ubi_wl_entry *e,
30 					       struct rb_root *root) {
31 	return e;
32 }
33 #endif /* CONFIG_MTD_UBI_FASTMAP */
34 #endif /* UBI_WL_H */
35