From: David Brownell Date: Tue, 14 Mar 2006 05:20:40 +0000 (-0800) Subject: [PATCH] mtd_dataflash, fix block vs page erase X-Git-Tag: v2.6.16~46 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=3cb4f09fc2e98bbf26f8c900a94bf3910cd4d823;p=linux-2.6-omap-h63xx.git [PATCH] mtd_dataflash, fix block vs page erase Fix a bug in the block-erase optimization for Dataflash; it was using block erase even for smaller segments that need page erase. That wouldn't matter for JFFS2, which never erases less than one block (sometimes several blocks), but for other callers it might. Signed-off-by: David Brownell Acked-by: David Woodhouse Acked-by: Thomas Gleixner Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c index 155737e7483..a19480d0788 100644 --- a/drivers/mtd/devices/mtd_dataflash.c +++ b/drivers/mtd/devices/mtd_dataflash.c @@ -178,7 +178,7 @@ static int dataflash_erase(struct mtd_info *mtd, struct erase_info *instr) * we're at a block boundary and need to erase the whole block. */ pageaddr = instr->addr / priv->page_size; - do_block = (pageaddr & 0x7) == 0 && instr->len <= blocksize; + do_block = (pageaddr & 0x7) == 0 && instr->len >= blocksize; pageaddr = pageaddr << priv->page_offset; command[0] = do_block ? OP_ERASE_BLOCK : OP_ERASE_PAGE;