diff options
author | Boris Brezillon <boris.brezillon@bootlin.com> | 2018-02-12 22:03:09 +0100 |
---|---|---|
committer | Boris Brezillon <boris.brezillon@bootlin.com> | 2018-03-15 18:21:07 +0100 |
commit | 884cfd9023ce6afe8bcf181ec988d8516eb32bf0 (patch) | |
tree | f57f5eafe52a568ac90e25b64f8e6a0e9d37e993 /drivers/mtd/ubi | |
parent | mtd: Get rid of unused fields in struct erase_info (diff) | |
download | linux-884cfd9023ce6afe8bcf181ec988d8516eb32bf0.tar.xz linux-884cfd9023ce6afe8bcf181ec988d8516eb32bf0.zip |
mtd: Stop assuming mtd_erase() is asynchronous
None of the mtd->_erase() implementations work in an asynchronous manner,
so let's simplify MTD users that call mtd_erase(). All they need to do
is check the value returned by mtd_erase() and assume that != 0 means
failure.
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'drivers/mtd/ubi')
-rw-r--r-- | drivers/mtd/ubi/io.c | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c index 8290432017ce..8843d26837b2 100644 --- a/drivers/mtd/ubi/io.c +++ b/drivers/mtd/ubi/io.c @@ -309,18 +309,6 @@ int ubi_io_write(struct ubi_device *ubi, const void *buf, int pnum, int offset, } /** - * erase_callback - MTD erasure call-back. - * @ei: MTD erase information object. - * - * Note, even though MTD erase interface is asynchronous, all the current - * implementations are synchronous anyway. - */ -static void erase_callback(struct erase_info *ei) -{ - wake_up_interruptible((wait_queue_head_t *)ei->priv); -} - -/** * do_sync_erase - synchronously erase a physical eraseblock. * @ubi: UBI device description object * @pnum: the physical eraseblock number to erase @@ -333,7 +321,6 @@ static int do_sync_erase(struct ubi_device *ubi, int pnum) { int err, retries = 0; struct erase_info ei; - wait_queue_head_t wq; dbg_io("erase PEB %d", pnum); ubi_assert(pnum >= 0 && pnum < ubi->peb_count); @@ -344,14 +331,11 @@ static int do_sync_erase(struct ubi_device *ubi, int pnum) } retry: - init_waitqueue_head(&wq); memset(&ei, 0, sizeof(struct erase_info)); ei.mtd = ubi->mtd; ei.addr = (loff_t)pnum * ubi->peb_size; ei.len = ubi->peb_size; - ei.callback = erase_callback; - ei.priv = (unsigned long)&wq; err = mtd_erase(ubi->mtd, &ei); if (err) { @@ -366,25 +350,6 @@ retry: return err; } - err = wait_event_interruptible(wq, ei.state == MTD_ERASE_DONE || - ei.state == MTD_ERASE_FAILED); - if (err) { - ubi_err(ubi, "interrupted PEB %d erasure", pnum); - return -EINTR; - } - - if (ei.state == MTD_ERASE_FAILED) { - if (retries++ < UBI_IO_RETRIES) { - ubi_warn(ubi, "error while erasing PEB %d, retry", - pnum); - yield(); - goto retry; - } - ubi_err(ubi, "cannot erase PEB %d", pnum); - dump_stack(); - return -EIO; - } - err = ubi_self_check_all_ff(ubi, pnum, 0, ubi->peb_size); if (err) return err; |