]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] mtd_dataflash, fix block vs page erase
authorDavid Brownell <david-b@pacbell.net>
Tue, 14 Mar 2006 05:20:40 +0000 (21:20 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 14 Mar 2006 15:57:17 +0000 (07:57 -0800)
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 <dbrownell@users.sourceforge.net>
Acked-by: David Woodhouse <dwmw2@infradead.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/mtd/devices/mtd_dataflash.c

index 155737e7483f666d9ac11bfd44a298b311ad578f..a19480d07888dfd043872b2e5d715755851a17e8 100644 (file)
@@ -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;