Commit 3cb4f09f authored by David Brownell's avatar David Brownell Committed by Linus Torvalds

[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: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Acked-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 3759fa9c
...@@ -178,7 +178,7 @@ static int dataflash_erase(struct mtd_info *mtd, struct erase_info *instr) ...@@ -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. * we're at a block boundary and need to erase the whole block.
*/ */
pageaddr = instr->addr / priv->page_size; 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; pageaddr = pageaddr << priv->page_offset;
command[0] = do_block ? OP_ERASE_BLOCK : OP_ERASE_PAGE; command[0] = do_block ? OP_ERASE_BLOCK : OP_ERASE_PAGE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment