diff options
author | Boris Brezillon | 2018-02-12 22:03:09 +0100 |
---|---|---|
committer | Boris Brezillon | 2018-03-15 18:21:07 +0100 |
commit | 884cfd9023ce6afe8bcf181ec988d8516eb32bf0 (patch) | |
tree | f57f5eafe52a568ac90e25b64f8e6a0e9d37e993 /drivers/mtd/sm_ftl.c | |
parent | dcba51bbb9e0cc7f80d36eb20a033a4dff2ce9cc (diff) |
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/sm_ftl.c')
-rw-r--r-- | drivers/mtd/sm_ftl.c | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/drivers/mtd/sm_ftl.c b/drivers/mtd/sm_ftl.c index 4237c7cebf02..c11156f9d96f 100644 --- a/drivers/mtd/sm_ftl.c +++ b/drivers/mtd/sm_ftl.c @@ -461,10 +461,8 @@ static int sm_erase_block(struct sm_ftl *ftl, int zone_num, uint16_t block, struct erase_info erase; erase.mtd = mtd; - erase.callback = sm_erase_callback; erase.addr = sm_mkoffset(ftl, zone_num, block, 0); erase.len = ftl->block_size; - erase.priv = (u_long)ftl; if (ftl->unstable) return -EIO; @@ -482,15 +480,6 @@ static int sm_erase_block(struct sm_ftl *ftl, int zone_num, uint16_t block, goto error; } - if (erase.state == MTD_ERASE_PENDING) - wait_for_completion(&ftl->erase_completion); - - if (erase.state != MTD_ERASE_DONE) { - sm_printk("erase of block %d in zone %d failed after wait", - block, zone_num); - goto error; - } - if (put_free) kfifo_in(&zone->free_sectors, (const unsigned char *)&block, sizeof(block)); @@ -501,12 +490,6 @@ error: return -EIO; } -static void sm_erase_callback(struct erase_info *self) -{ - struct sm_ftl *ftl = (struct sm_ftl *)self->priv; - complete(&ftl->erase_completion); -} - /* Thoroughly test that block is valid. */ static int sm_check_block(struct sm_ftl *ftl, int zone, int block) { @@ -1141,7 +1124,6 @@ static void sm_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd) mutex_init(&ftl->mutex); timer_setup(&ftl->timer, sm_cache_flush_timer, 0); INIT_WORK(&ftl->flush_work, sm_cache_flush_work); - init_completion(&ftl->erase_completion); /* Read media information */ if (sm_get_media_info(ftl, mtd)) { |