Messages in this thread Patch in this message | | | From | Richard Weinberger <> | Subject | [PATCH 1/4] UBI: Introduce ubi_schedule_fm_work() | Date | Sun, 29 Mar 2015 14:13:14 +0200 |
| |
Wrap the fastmap work scheduling code into a new function such that it can be reused.
Signed-off-by: Richard Weinberger <richard@nod.at> --- drivers/mtd/ubi/fastmap-wl.c | 5 +---- drivers/mtd/ubi/ubi.h | 12 ++++++++++++ 2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/ubi/fastmap-wl.c b/drivers/mtd/ubi/fastmap-wl.c index b2a6653..fc0e2ff 100644 --- a/drivers/mtd/ubi/fastmap-wl.c +++ b/drivers/mtd/ubi/fastmap-wl.c @@ -237,10 +237,7 @@ static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi) /* We cannot update the fastmap here because this * function is called in atomic context. * Let's fail here and refill/update it as soon as possible. */ - if (!ubi->fm_work_scheduled) { - ubi->fm_work_scheduled = 1; - schedule_work(&ubi->fm_work); - } + ubi_schedule_fm_work(ubi); return NULL; } diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h index 11f8fb0..cb3dcd0 100644 --- a/drivers/mtd/ubi/ubi.h +++ b/drivers/mtd/ubi/ubi.h @@ -881,8 +881,20 @@ size_t ubi_calc_fm_size(struct ubi_device *ubi); int ubi_update_fastmap(struct ubi_device *ubi); int ubi_scan_fastmap(struct ubi_device *ubi, struct ubi_attach_info *ai, int fm_anchor); +/** + * ubi_schedule_fm_work - Schedule UBI fastmap work + * @ubi: UBI device description object + */ +static inline void ubi_schedule_fm_work(struct ubi_device *ubi) +{ + if (!ubi->fm_work_scheduled) { + ubi->fm_work_scheduled = 1; + schedule_work(&ubi->fm_work); + } +} #else static inline int ubi_update_fastmap(struct ubi_device *ubi) { return 0; } +static inline void ubi_schedule_fm_work(struct ubi_device *ubi) { } #endif /* block.c */ -- 1.8.4.5
| |