mtd/drivers/mtd mtdpart.c,1.53,1.54

Artem Bityutskiy dedekind at infradead.org
Fri Sep 30 10:49:12 EDT 2005


Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv21096/drivers/mtd

Modified Files:
	mtdpart.c 
Log Message:
[MTD] Don't assume eraseblock size is power of 2

From: Peter Menzebach <pm-mtd at mw-itcon.de>
Acked-by: Artem B. Bityutskiy <dedekind at infradead.org>



Index: mtdpart.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdpart.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- mtdpart.c	8 Feb 2005 17:11:13 -0000	1.53
+++ mtdpart.c	30 Sep 2005 14:49:08 -0000	1.54
@@ -465,9 +465,10 @@
 		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);





More information about the linux-mtd-cvs mailing list