summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2005-06-30 23:01:09 +0100
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-06-30 23:01:09 +0100
commit747aead34de65c25765da79825ce2c08d8257b10 (patch)
tree1edbf084b3e08fc0623431278f5dc0fda67ef634 /drivers
parentabaf48a05a8f097654e746af2a5afb2ab95861a1 (diff)
[PATCH] ARM: 2780/1: AFS partition length calculation fix
Patch from Catalin Marinas This patch calculates the AFS partition length by expanding the image length information to the nearest erase block boundary. This eliminates the problems with JFFS2 erasing the footer. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/afs.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/drivers/mtd/afs.c b/drivers/mtd/afs.c
index 801e6c7d089..7363e101eb0 100644
--- a/drivers/mtd/afs.c
+++ b/drivers/mtd/afs.c
@@ -219,7 +219,7 @@ static int parse_afs_partitions(struct mtd_info *mtd,
*/
for (idx = off = 0; off < mtd->size; off += mtd->erasesize) {
struct image_info_struct iis;
- u_int iis_ptr, img_ptr, size;
+ u_int iis_ptr, img_ptr;
/* Read the footer. */
ret = afs_read_footer(mtd, &img_ptr, &iis_ptr, off, mask);
@@ -236,21 +236,9 @@ static int parse_afs_partitions(struct mtd_info *mtd,
continue;
strcpy(str, iis.name);
- size = mtd->erasesize + off - img_ptr;
-
- /*
- * In order to support JFFS2 partitions on this layout,
- * we must lie to MTD about the real size of JFFS2
- * partitions; this ensures that the AFS flash footer
- * won't be erased by JFFS2. Please ensure that your
- * JFFS2 partitions are given image numbers between
- * 1000 and 2000 inclusive.
- */
- if (iis.imageNumber >= 1000 && iis.imageNumber < 2000)
- size -= mtd->erasesize;
parts[idx].name = str;
- parts[idx].size = size;
+ parts[idx].size = (iis.length + mtd->erasesize - 1) & ~(mtd->erasesize - 1);
parts[idx].offset = img_ptr;
parts[idx].mask_flags = 0;