X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fmtd%2Fafs.c;h=52d51eb91c16f7c1a7a5ec7c3cbbcd5936cb5a39;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=801e6c7d08920e4c80babcb1c23bc239f4d869ab;hpb=9bf4aaab3e101692164d49b7ca357651eb691cb6;p=linux-2.6.git diff --git a/drivers/mtd/afs.c b/drivers/mtd/afs.c index 801e6c7d0..52d51eb91 100644 --- a/drivers/mtd/afs.c +++ b/drivers/mtd/afs.c @@ -1,27 +1,27 @@ /*====================================================================== drivers/mtd/afs.c: ARM Flash Layout/Partitioning - + Copyright (C) 2000 ARM Limited - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - This is access code for flashes using ARM's flash partitioning + + This is access code for flashes using ARM's flash partitioning standards. - $Id: afs.c,v 1.13 2004/02/27 22:09:59 rmk Exp $ + $Id: afs.c,v 1.15 2005/11/07 11:14:19 gleixner Exp $ ======================================================================*/ @@ -163,7 +163,7 @@ afs_read_iis(struct mtd_info *mtd, struct image_info_struct *iis, u_int ptr) return ret; } -static int parse_afs_partitions(struct mtd_info *mtd, +static int parse_afs_partitions(struct mtd_info *mtd, struct mtd_partition **pparts, unsigned long origin) { @@ -207,11 +207,10 @@ static int parse_afs_partitions(struct mtd_info *mtd, if (!sz) return ret; - parts = kmalloc(sz, GFP_KERNEL); + parts = kzalloc(sz, GFP_KERNEL); if (!parts) return -ENOMEM; - memset(parts, 0, sz); str = (char *)(parts + idx); /* @@ -219,7 +218,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 +235,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;