9
0
Fork 0

mtd: call mtd_erase with complete area if possible

If a device does not have bad blocks loop over the eraseblocks
in the driver instead of the core. This allows the mtd_dataflash
driver to erase blocks instead of pages to gain more speed during
erasing. Also the mtd_dataflash driver modifies the erase_info
struct which causes the outer loop in the core to never end.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2013-05-25 00:16:31 +02:00
parent ecceaac8e7
commit 0d7ac7c381
1 changed files with 6 additions and 0 deletions

View File

@ -107,6 +107,12 @@ static int mtd_op_erase(struct cdev *cdev, size_t count, loff_t offset)
memset(&erase, 0, sizeof(erase));
erase.mtd = mtd;
erase.addr = offset;
if (!mtd->block_isbad) {
erase.len = count;
return mtd_erase(mtd, &erase);
}
erase.len = mtd->erasesize;
while (count > 0) {