diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 5953e36..617c63e 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c @@ -668,7 +668,9 @@ * checks @ubi->thread_enabled. Otherwise we may fail to wake it up. */ ubi->thread_enabled = 1; - wake_up_process(ubi->bgt_thread); + + /* No threading, call ubi_thread directly */ + ubi_thread(ubi); ubi_devices[ubi_num] = ubi; diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h index 89e3347..1f0ad38 100644 --- a/drivers/mtd/ubi/ubi.h +++ b/drivers/mtd/ubi/ubi.h @@ -788,7 +788,7 @@ int ubi_wl_scrub_peb(struct ubi_device *ubi, int pnum); int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai); void ubi_wl_close(struct ubi_device *ubi); -int ubi_thread(void *u); +int ubi_thread(struct ubi_device *ubi); struct ubi_wl_entry *ubi_wl_get_fm_peb(struct ubi_device *ubi, int anchor); int ubi_wl_put_fm_peb(struct ubi_device *ubi, struct ubi_wl_entry *used_e, int lnum, int torture); diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index f24c219..a368bf9 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c @@ -523,7 +523,7 @@ ubi->works_count += 1; /* No threading in barebox, so do work synchronously */ - do_work(ubi); + ubi_thread(ubi); } /** @@ -1329,6 +1329,29 @@ } /** + * ubi_thread - UBI background thread. + * @ubi: UBI device description object + * + * for barebox this is no thread, instead it's called synchronously from + * __schedule_ubi_work(). This is the place that makes sure all pending + * work is done. + */ +int ubi_thread(struct ubi_device *ubi) +{ + while (!list_empty(&ubi->works)) { + if (!ubi->thread_enabled) + return 0; + + if (ubi->ro_mode) + return 0; + + do_work(ubi); + } + + return 0; +} + +/** * shutdown_work - shutdown all pending works. * @ubi: UBI device description object */