diff options
author | 2018-02-12 22:03:09 +0100 | |
---|---|---|
committer | 2018-03-15 18:21:07 +0100 | |
commit | 884cfd9023ce6afe8bcf181ec988d8516eb32bf0 (patch) | |
tree | f57f5eafe52a568ac90e25b64f8e6a0e9d37e993 /drivers/mtd/mtdblock.c | |
parent | mtd: Get rid of unused fields in struct erase_info (diff) | |
download | linux-884cfd9023ce6afe8bcf181ec988d8516eb32bf0.tar.gz linux-884cfd9023ce6afe8bcf181ec988d8516eb32bf0.tar.bz2 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/mtdblock.c')
-rw-r--r-- | drivers/mtd/mtdblock.c | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/drivers/mtd/mtdblock.c b/drivers/mtd/mtdblock.c index bb4c14f83c75..7b2b7f651181 100644 --- a/drivers/mtd/mtdblock.c +++ b/drivers/mtd/mtdblock.c @@ -55,48 +55,28 @@ struct mtdblk_dev { * being written to until a different sector is required. */ -static void erase_callback(struct erase_info *done) -{ - wait_queue_head_t *wait_q = (wait_queue_head_t *)done->priv; - wake_up(wait_q); -} - static int erase_write (struct mtd_info *mtd, unsigned long pos, int len, const char *buf) { struct erase_info erase; - DECLARE_WAITQUEUE(wait, current); - wait_queue_head_t wait_q; size_t retlen; int ret; /* * First, let's erase the flash block. */ - - init_waitqueue_head(&wait_q); erase.mtd = mtd; - erase.callback = erase_callback; erase.addr = pos; erase.len = len; - erase.priv = (u_long)&wait_q; - - set_current_state(TASK_INTERRUPTIBLE); - add_wait_queue(&wait_q, &wait); ret = mtd_erase(mtd, &erase); if (ret) { - set_current_state(TASK_RUNNING); - remove_wait_queue(&wait_q, &wait); printk (KERN_WARNING "mtdblock: erase of region [0x%lx, 0x%x] " "on \"%s\" failed\n", pos, len, mtd->name); return ret; } - schedule(); /* Wait for erase to finish. */ - remove_wait_queue(&wait_q, &wait); - /* * Next, write the data to flash. */ |