diff options
author | Artem B. Bityutskiy <dedekind@infradead.org> | 2005-09-30 15:49:12 +0100 |
---|---|---|
committer | Thomas Gleixner <tglx@mtd.linutronix.de> | 2005-11-06 23:04:14 +0100 |
commit | 5cea5dadfebdede8045fca118328860058129eb2 (patch) | |
tree | 341645da538e4606a139d7b3cbce23e0901a9ca2 /drivers/mtd/mtdpart.c | |
parent | daba5cc4bcd025a9b4fd02a9117c71bfd400d811 (diff) | |
download | blackbird-op-linux-5cea5dadfebdede8045fca118328860058129eb2.tar.gz blackbird-op-linux-5cea5dadfebdede8045fca118328860058129eb2.zip |
[MTD] mtdpart.c: Allow eraseblock size != power of 2
Don't assume eraseblock size is power of 2.
Dataflash can have aligned eraseblock size.
From: Peter Menzebach <pm-mtd@mw-itcon.de>
Acked-by: Artem B. Bityutskiy <dedekind@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/mtd/mtdpart.c')
-rw-r--r-- | drivers/mtd/mtdpart.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index b92e6bfffaf2..e9168b5cd518 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c @@ -5,7 +5,7 @@ * * This code is GPL * - * $Id: mtdpart.c,v 1.53 2005/02/08 17:11:13 nico Exp $ + * $Id: mtdpart.c,v 1.54 2005/09/30 14:49:08 dedekind Exp $ * * 02-21-2002 Thomas Gleixner <gleixner@autronix.de> * added support for read_oob, write_oob @@ -465,9 +465,10 @@ int add_mtd_partitions(struct mtd_info *master, if (slave->offset == MTDPART_OFS_APPEND) slave->offset = cur_offset; if (slave->offset == MTDPART_OFS_NXTBLK) { - u_int32_t emask = master->erasesize-1; - slave->offset = (cur_offset + emask) & ~emask; - if (slave->offset != cur_offset) { + slave->offset = cur_offset; + if ((cur_offset % master->erasesize) != 0) { + /* Round up to next erasesize */ + slave->offset = ((cur_offset / master->erasesize) + 1) * master->erasesize; printk(KERN_NOTICE "Moving partition %d: " "0x%08x -> 0x%08x\n", i, cur_offset, slave->offset); |