mtd_dataflash: unbreak erase support
authorPeter Korsgaard <jacmet@sunsite.dk>
Mon, 18 May 2009 10:13:54 +0000 (11:13 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 18 May 2009 15:36:21 +0000 (08:36 -0700)
Commit 5b7f3a50 (fix dataflash 64-bit divisions) unfortunately
introduced a typo. Erase addr and len were swapped in the pageaddr
calculation, causing the wrong sectors to get erased.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/mtd/devices/mtd_dataflash.c

index 62dee54af0a58bfc4f1efe8cf8d8f6096ac95c0c..43976aa4dbb12fd05ce52c63a8a355c947e59205 100644 (file)
@@ -178,7 +178,7 @@ static int dataflash_erase(struct mtd_info *mtd, struct erase_info *instr)
                /* Calculate flash page address; use block erase (for speed) if
                 * we're at a block boundary and need to erase the whole block.
                 */
-               pageaddr = div_u64(instr->len, priv->page_size);
+               pageaddr = div_u64(instr->addr, priv->page_size);
                do_block = (pageaddr & 0x7) == 0 && instr->len >= blocksize;
                pageaddr = pageaddr << priv->page_offset;