diff options
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/devices/bcm47xxsflash.c | 3 | ||||
-rw-r--r-- | drivers/mtd/ftl.c | 51 | ||||
-rw-r--r-- | drivers/mtd/inftlmount.c | 5 | ||||
-rw-r--r-- | drivers/mtd/mtdblock.c | 20 | ||||
-rw-r--r-- | drivers/mtd/mtdchar.c | 33 | ||||
-rw-r--r-- | drivers/mtd/mtdconcat.c | 48 | ||||
-rw-r--r-- | drivers/mtd/mtdcore.c | 8 | ||||
-rw-r--r-- | drivers/mtd/mtdoops.c | 19 | ||||
-rw-r--r-- | drivers/mtd/mtdpart.c | 2 | ||||
-rw-r--r-- | drivers/mtd/mtdswap.c | 32 | ||||
-rw-r--r-- | drivers/mtd/nftlmount.c | 4 | ||||
-rw-r--r-- | drivers/mtd/rfd_ftl.c | 92 | ||||
-rw-r--r-- | drivers/mtd/sm_ftl.c | 18 | ||||
-rw-r--r-- | drivers/mtd/sm_ftl.h | 4 | ||||
-rw-r--r-- | drivers/mtd/tests/mtd_test.c | 4 | ||||
-rw-r--r-- | drivers/mtd/tests/speedtest.c | 6 | ||||
-rw-r--r-- | drivers/mtd/ubi/io.c | 35 |
17 files changed, 47 insertions, 337 deletions
diff --git a/drivers/mtd/devices/bcm47xxsflash.c b/drivers/mtd/devices/bcm47xxsflash.c index e2bd81817df4..6b84947cfbea 100644 --- a/drivers/mtd/devices/bcm47xxsflash.c +++ b/drivers/mtd/devices/bcm47xxsflash.c @@ -95,9 +95,6 @@ static int bcm47xxsflash_erase(struct mtd_info *mtd, struct erase_info *erase) else erase->state = MTD_ERASE_DONE; - if (erase->callback) - erase->callback(erase); - return err; } diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c index 664d206a4cbe..fcf9907e7987 100644 --- a/drivers/mtd/ftl.c +++ b/drivers/mtd/ftl.c @@ -140,12 +140,6 @@ typedef struct partition_t { #define XFER_PREPARED 0x03 #define XFER_FAILED 0x04 -/*====================================================================*/ - - -static void ftl_erase_callback(struct erase_info *done); - - /*====================================================================== Scan_header() checks to see if a memory region contains an FTL @@ -349,17 +343,19 @@ static int erase_xfer(partition_t *part, return -ENOMEM; erase->mtd = part->mbd.mtd; - erase->callback = ftl_erase_callback; erase->addr = xfer->Offset; erase->len = 1 << part->header.EraseUnitSize; - erase->priv = (u_long)part; ret = mtd_erase(part->mbd.mtd, erase); + if (!ret) { + xfer->state = XFER_ERASED; + xfer->EraseCount++; + } else { + xfer->state = XFER_FAILED; + pr_notice("ftl_cs: erase failed: err = %d\n", ret); + } - if (!ret) - xfer->EraseCount++; - else - kfree(erase); + kfree(erase); return ret; } /* erase_xfer */ @@ -371,37 +367,6 @@ static int erase_xfer(partition_t *part, ======================================================================*/ -static void ftl_erase_callback(struct erase_info *erase) -{ - partition_t *part; - struct xfer_info_t *xfer; - int i; - - /* Look up the transfer unit */ - part = (partition_t *)(erase->priv); - - for (i = 0; i < part->header.NumTransferUnits; i++) - if (part->XferInfo[i].Offset == erase->addr) break; - - if (i == part->header.NumTransferUnits) { - printk(KERN_NOTICE "ftl_cs: internal error: " - "erase lookup failed!\n"); - return; - } - - xfer = &part->XferInfo[i]; - if (erase->state == MTD_ERASE_DONE) - xfer->state = XFER_ERASED; - else { - xfer->state = XFER_FAILED; - printk(KERN_NOTICE "ftl_cs: erase failed: state = %d\n", - erase->state); - } - - kfree(erase); - -} /* ftl_erase_callback */ - static int prepare_xfer(partition_t *part, int i) { erase_unit_header_t header; diff --git a/drivers/mtd/inftlmount.c b/drivers/mtd/inftlmount.c index 8d6bb189ea8e..0f47be4834d8 100644 --- a/drivers/mtd/inftlmount.c +++ b/drivers/mtd/inftlmount.c @@ -393,9 +393,10 @@ int INFTL_formatblock(struct INFTLrecord *inftl, int block) mark only the failed block in the bbt. */ for (physblock = 0; physblock < inftl->EraseSize; physblock += instr->len, instr->addr += instr->len) { - mtd_erase(inftl->mbd.mtd, instr); + int ret; - if (instr->state == MTD_ERASE_FAILED) { + ret = mtd_erase(inftl->mbd.mtd, instr); + if (ret) { printk(KERN_WARNING "INFTL: error while formatting block %d\n", block); goto fail; 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. */ diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index de8c902059b8..2beb22dd6bbb 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c @@ -324,10 +324,6 @@ static ssize_t mtdchar_write(struct file *file, const char __user *buf, size_t c IOCTL calls for getting device parameters. ======================================================================*/ -static void mtdchar_erase_callback (struct erase_info *instr) -{ - wake_up((wait_queue_head_t *)instr->priv); -} static int otp_select_filemode(struct mtd_file_info *mfi, int mode) { @@ -709,11 +705,6 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg) if (!erase) ret = -ENOMEM; else { - wait_queue_head_t waitq; - DECLARE_WAITQUEUE(wait, current); - - init_waitqueue_head(&waitq); - if (cmd == MEMERASE64) { struct erase_info_user64 einfo64; @@ -736,30 +727,8 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg) erase->len = einfo32.length; } erase->mtd = mtd; - erase->callback = mtdchar_erase_callback; - erase->priv = (unsigned long)&waitq; - - /* - FIXME: Allow INTERRUPTIBLE. Which means - not having the wait_queue head on the stack. - - If the wq_head is on the stack, and we - leave because we got interrupted, then the - wq_head is no longer there when the - callback routine tries to wake us up. - */ + ret = mtd_erase(mtd, erase); - if (!ret) { - set_current_state(TASK_UNINTERRUPTIBLE); - add_wait_queue(&waitq, &wait); - if (erase->state != MTD_ERASE_DONE && - erase->state != MTD_ERASE_FAILED) - schedule(); - remove_wait_queue(&waitq, &wait); - set_current_state(TASK_RUNNING); - - ret = (erase->state == MTD_ERASE_FAILED)?-EIO:0; - } kfree(erase); } break; diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index 60bf53df5454..caa09bf6e572 100644 --- a/drivers/mtd/mtdconcat.c +++ b/drivers/mtd/mtdconcat.c @@ -333,45 +333,6 @@ concat_write_oob(struct mtd_info *mtd, loff_t to, struct mtd_oob_ops *ops) return -EINVAL; } -static void concat_erase_callback(struct erase_info *instr) -{ - wake_up((wait_queue_head_t *) instr->priv); -} - -static int concat_dev_erase(struct mtd_info *mtd, struct erase_info *erase) -{ - int err; - wait_queue_head_t waitq; - DECLARE_WAITQUEUE(wait, current); - - /* - * This code was stol^H^H^H^Hinspired by mtdchar.c - */ - init_waitqueue_head(&waitq); - - erase->mtd = mtd; - erase->callback = concat_erase_callback; - erase->priv = (unsigned long) &waitq; - - /* - * FIXME: Allow INTERRUPTIBLE. Which means - * not having the wait_queue head on the stack. - */ - err = mtd_erase(mtd, erase); - if (!err) { - set_current_state(TASK_UNINTERRUPTIBLE); - add_wait_queue(&waitq, &wait); - if (erase->state != MTD_ERASE_DONE - && erase->state != MTD_ERASE_FAILED) - schedule(); - remove_wait_queue(&waitq, &wait); - set_current_state(TASK_RUNNING); - - err = (erase->state == MTD_ERASE_FAILED) ? -EIO : 0; - } - return err; -} - static int concat_erase(struct mtd_info *mtd, struct erase_info *instr) { struct mtd_concat *concat = CONCAT(mtd); @@ -466,7 +427,8 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr) erase->len = length; length -= erase->len; - if ((err = concat_dev_erase(subdev, erase))) { + erase->mtd = subdev; + if ((err = mtd_erase(subdev, erase))) { /* sanity check: should never happen since * block alignment has been checked above */ BUG_ON(err == -EINVAL); @@ -487,12 +449,8 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr) } instr->state = erase->state; kfree(erase); - if (err) - return err; - if (instr->callback) - instr->callback(instr); - return 0; + return err; } static int concat_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index c87859ff338b..f92ad02959eb 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -945,11 +945,9 @@ void __put_mtd_device(struct mtd_info *mtd) EXPORT_SYMBOL_GPL(__put_mtd_device); /* - * Erase is an asynchronous operation. Device drivers are supposed - * to call instr->callback() whenever the operation completes, even - * if it completes with a failure. - * Callers are supposed to pass a callback function and wait for it - * to be called before writing to the block. + * Erase is an synchronous operation. Device drivers are epected to return a + * negative error code if the operation failed and update instr->fail_addr + * to point the portion that was not properly erased. */ int mtd_erase(struct mtd_info *mtd, struct erase_info *instr) { diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c index 97bb8f6304d4..028ded59297b 100644 --- a/drivers/mtd/mtdoops.c +++ b/drivers/mtd/mtdoops.c @@ -84,12 +84,6 @@ static int page_is_used(struct mtdoops_context *cxt, int page) return test_bit(page, cxt->oops_page_used); } -static void mtdoops_erase_callback(struct erase_info *done) -{ - wait_queue_head_t *wait_q = (wait_queue_head_t *)done->priv; - wake_up(wait_q); -} - static int mtdoops_erase_block(struct mtdoops_context *cxt, int offset) { struct mtd_info *mtd = cxt->mtd; @@ -97,34 +91,21 @@ static int mtdoops_erase_block(struct mtdoops_context *cxt, int offset) u32 start_page = start_page_offset / record_size; u32 erase_pages = mtd->erasesize / record_size; struct erase_info erase; - DECLARE_WAITQUEUE(wait, current); - wait_queue_head_t wait_q; int ret; int page; - init_waitqueue_head(&wait_q); erase.mtd = mtd; - erase.callback = mtdoops_erase_callback; erase.addr = offset; erase.len = mtd->erasesize; - 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 "mtdoops: erase of region [0x%llx, 0x%llx] on \"%s\" failed\n", (unsigned long long)erase.addr, (unsigned long long)erase.len, mtddev); return ret; } - schedule(); /* Wait for erase to finish. */ - remove_wait_queue(&wait_q, &wait); - /* Mark pages as unused */ for (page = start_page; page < start_page + erase_pages; page++) mark_page_unused(cxt, page); diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 76cd21d1171b..ae1206633d9d 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c @@ -222,8 +222,6 @@ void mtd_erase_callback(struct erase_info *instr) instr->fail_addr -= part->offset; instr->addr -= part->offset; } - if (instr->callback) - instr->callback(instr); } EXPORT_SYMBOL_GPL(mtd_erase_callback); diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c index 7eb0e1f4f980..d390324d102e 100644 --- a/drivers/mtd/mtdswap.c +++ b/drivers/mtd/mtdswap.c @@ -536,18 +536,10 @@ static void mtdswap_store_eb(struct mtdswap_dev *d, struct swap_eb *eb) mtdswap_rb_add(d, eb, MTDSWAP_HIFRAG); } - -static void mtdswap_erase_callback(struct erase_info *done) -{ - wait_queue_head_t *wait_q = (wait_queue_head_t *)done->priv; - wake_up(wait_q); -} - static int mtdswap_erase_block(struct mtdswap_dev *d, struct swap_eb *eb) { struct mtd_info *mtd = d->mtd; struct erase_info erase; - wait_queue_head_t wq; unsigned int retries = 0; int ret; @@ -556,14 +548,11 @@ static int mtdswap_erase_block(struct mtdswap_dev *d, struct swap_eb *eb) d->max_erase_count = eb->erase_count; retry: - init_waitqueue_head(&wq); memset(&erase, 0, sizeof(struct erase_info)); erase.mtd = mtd; - erase.callback = mtdswap_erase_callback; erase.addr = mtdswap_eb_offset(d, eb); erase.len = mtd->erasesize; - erase.priv = (u_long)&wq; ret = mtd_erase(mtd, &erase); if (ret) { @@ -582,27 +571,6 @@ retry: return -EIO; } - ret = wait_event_interruptible(wq, erase.state == MTD_ERASE_DONE || - erase.state == MTD_ERASE_FAILED); - if (ret) { - dev_err(d->dev, "Interrupted erase block %#llx erasure on %s\n", - erase.addr, mtd->name); - return -EINTR; - } - - if (erase.state == MTD_ERASE_FAILED) { - if (retries++ < MTDSWAP_ERASE_RETRIES) { - dev_warn(d->dev, - "erase of erase block %#llx on %s failed", - erase.addr, mtd->name); - yield(); - goto retry; - } - - mtdswap_handle_badblock(d, eb); - return -EIO; - } - return 0; } diff --git a/drivers/mtd/nftlmount.c b/drivers/mtd/nftlmount.c index 184c8fbfe465..07e122449759 100644 --- a/drivers/mtd/nftlmount.c +++ b/drivers/mtd/nftlmount.c @@ -331,9 +331,7 @@ int NFTL_formatblock(struct NFTLrecord *nftl, int block) instr->mtd = nftl->mbd.mtd; instr->addr = block * nftl->EraseSize; instr->len = nftl->EraseSize; - mtd_erase(mtd, instr); - - if (instr->state == MTD_ERASE_FAILED) { + if (mtd_erase(mtd, instr)) { printk("Error while formatting block %d\n", block); goto fail; } diff --git a/drivers/mtd/rfd_ftl.c b/drivers/mtd/rfd_ftl.c index d1cbf26db2c0..4e0b55cd08e2 100644 --- a/drivers/mtd/rfd_ftl.c +++ b/drivers/mtd/rfd_ftl.c @@ -266,91 +266,55 @@ static int rfd_ftl_readsect(struct mtd_blktrans_dev *dev, u_long sector, char *b return 0; } -static void erase_callback(struct erase_info *erase) -{ - struct partition *part; - u16 magic; - int i, rc; - size_t retlen; - - part = (struct partition*)erase->priv; - - i = (u32)erase->addr / part->block_size; - if (i >= part->total_blocks || part->blocks[i].offset != erase->addr || - erase->addr > UINT_MAX) { - printk(KERN_ERR PREFIX "erase callback for unknown offset %llx " - "on '%s'\n", (unsigned long long)erase->addr, part->mbd.mtd->name); - return; - } - - if (erase->state != MTD_ERASE_DONE) { - printk(KERN_WARNING PREFIX "erase failed at 0x%llx on '%s', " - "state %d\n", (unsigned long long)erase->addr, - part->mbd.mtd->name, erase->state); - - part->blocks[i].state = BLOCK_FAILED; - part->blocks[i].free_sectors = 0; - part->blocks[i].used_sectors = 0; - - kfree(erase); - - return; - } - - magic = cpu_to_le16(RFD_MAGIC); - - part->blocks[i].state = BLOCK_ERASED; - part->blocks[i].free_sectors = part->data_sectors_per_block; - part->blocks[i].used_sectors = 0; - part->blocks[i].erases++; - - rc = mtd_write(part->mbd.mtd, part->blocks[i].offset, sizeof(magic), - &retlen, (u_char *)&magic); - - if (!rc && retlen != sizeof(magic)) - rc = -EIO; - - if (rc) { - printk(KERN_ERR PREFIX "'%s': unable to write RFD " - "header at 0x%lx\n", - part->mbd.mtd->name, - part->blocks[i].offset); - part->blocks[i].state = BLOCK_FAILED; - } - else - part->blocks[i].state = BLOCK_OK; - - kfree(erase); -} - static int erase_block(struct partition *part, int block) { struct erase_info *erase; - int rc = -ENOMEM; + int rc; erase = kmalloc(sizeof(struct erase_info), GFP_KERNEL); if (!erase) - goto err; + return -ENOMEM; erase->mtd = part->mbd.mtd; - erase->callback = erase_callback; erase->addr = part->blocks[block].offset; erase->len = part->block_size; - erase->priv = (u_long)part; part->blocks[block].state = BLOCK_ERASING; part->blocks[block].free_sectors = 0; rc = mtd_erase(part->mbd.mtd, erase); - if (rc) { printk(KERN_ERR PREFIX "erase of region %llx,%llx on '%s' " "failed\n", (unsigned long long)erase->addr, (unsigned long long)erase->len, part->mbd.mtd->name); - kfree(erase); + part->blocks[block].state = BLOCK_FAILED; + part->blocks[block].free_sectors = 0; + part->blocks[block].used_sectors = 0; + } else { + u16 magic = cpu_to_le16(RFD_MAGIC); + size_t retlen; + + part->blocks[block].state = BLOCK_ERASED; + part->blocks[block].free_sectors = part->data_sectors_per_block; + part->blocks[block].used_sectors = 0; + part->blocks[block].erases++; + + rc = mtd_write(part->mbd.mtd, part->blocks[block].offset, + sizeof(magic), &retlen, (u_char *)&magic); + if (!rc && retlen != sizeof(magic)) + rc = -EIO; + + if (rc) { + pr_err(PREFIX "'%s': unable to write RFD header at 0x%lx\n", + part->mbd.mtd->name, part->blocks[block].offset); + part->blocks[block].state = BLOCK_FAILED; + } else { + part->blocks[block].state = BLOCK_OK; + } } -err: + kfree(erase); + return rc; } 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)) { diff --git a/drivers/mtd/sm_ftl.h b/drivers/mtd/sm_ftl.h index 43bb7300785b..0a46d75cdc6a 100644 --- a/drivers/mtd/sm_ftl.h +++ b/drivers/mtd/sm_ftl.h @@ -53,9 +53,6 @@ struct sm_ftl { struct work_struct flush_work; struct timer_list timer; - /* Async erase stuff */ - struct completion erase_completion; - /* Geometry stuff */ int heads; int sectors; @@ -86,7 +83,6 @@ struct chs_entry { printk(KERN_DEBUG "sm_ftl" ": " format "\n", ## __VA_ARGS__) -static void sm_erase_callback(struct erase_info *self); static int sm_erase_block(struct sm_ftl *ftl, int zone_num, uint16_t block, int put_free); static void sm_mark_block_bad(struct sm_ftl *ftl, int zone_num, int block); diff --git a/drivers/mtd/tests/mtd_test.c b/drivers/mtd/tests/mtd_test.c index 3d0b8b5c1a53..0ac625e8f798 100644 --- a/drivers/mtd/tests/mtd_test.c +++ b/drivers/mtd/tests/mtd_test.c @@ -24,10 +24,6 @@ int mtdtest_erase_eraseblock(struct mtd_info *mtd, unsigned int ebnum) return err; } - if (ei.state == MTD_ERASE_FAILED) { - pr_info("some erase error occurred at EB %d\n", ebnum); - return -EIO; - } return 0; } diff --git a/drivers/mtd/tests/speedtest.c b/drivers/mtd/tests/speedtest.c index 0b89418a0888..f8e5dc11f943 100644 --- a/drivers/mtd/tests/speedtest.c +++ b/drivers/mtd/tests/speedtest.c @@ -70,12 +70,6 @@ static int multiblock_erase(int ebnum, int blocks) return err; } - if (ei.state == MTD_ERASE_FAILED) { - pr_err("some erase error occurred at EB %d," - "blocks %d\n", ebnum, blocks); - return -EIO; - } - return 0; } 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; |