mtd/drivers/mtd mtdpart.c,1.44,1.45 mtdconcat.c,1.8,1.9
dbrown at infradead.org
dbrown at infradead.org
Wed Jun 30 11:17:43 EDT 2004
Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv12929/drivers/mtd
Modified Files:
mtdpart.c mtdconcat.c
Log Message:
Add ability for callers to localize multi-block erase failures to a specific eraseblock. (NAND only)
Index: mtdpart.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdpart.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- mtdpart.c 6 May 2004 08:23:02 -0000 1.44
+++ mtdpart.c 30 Jun 2004 15:17:41 -0000 1.45
@@ -239,12 +239,16 @@
static int part_erase (struct mtd_info *mtd, struct erase_info *instr)
{
struct mtd_part *part = PART(mtd);
+ int ret;
if (!(mtd->flags & MTD_WRITEABLE))
return -EROFS;
if (instr->addr >= mtd->size)
return -EINVAL;
instr->addr += part->offset;
- return part->master->erase(part->master, instr);
+ ret = part->master->erase(part->master, instr);
+ if (instr->fail_addr != 0xffffffff)
+ instr->fail_addr -= part->offset;
+ return ret;
}
static int part_lock (struct mtd_info *mtd, loff_t ofs, size_t len)
Index: mtdconcat.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdconcat.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- mtdconcat.c 30 Jun 2003 11:01:26 -0000 1.8
+++ mtdconcat.c 30 Jun 2004 15:17:41 -0000 1.9
@@ -391,7 +391,7 @@
struct mtd_concat *concat = CONCAT(mtd);
struct mtd_info *subdev;
int i, err;
- u_int32_t length;
+ u_int32_t length, offset = 0;
struct erase_info *erase;
if (!(mtd->flags & MTD_WRITEABLE))
@@ -450,6 +450,8 @@
return -EINVAL;
}
+ instr->fail_addr = 0xffffffff;
+
/* make a local copy of instr to avoid modifying the caller's struct */
erase = kmalloc(sizeof (struct erase_info), GFP_KERNEL);
@@ -465,10 +467,12 @@
*/
for (i = 0; i < concat->num_subdev; i++) {
subdev = concat->subdev[i];
- if (subdev->size <= erase->addr)
+ if (subdev->size <= erase->addr) {
erase->addr -= subdev->size;
- else
+ offset += subdev->size;
+ } else {
break;
+ }
}
/* must never happen since size limit has been verified above */
@@ -497,6 +501,8 @@
* block alignment has been checked above */
if (err == -EINVAL)
BUG();
+ if (erase->fail_addr != 0xffffffff)
+ instr->fail_addr = erase->fail_addr + offset;
break;
}
/*
@@ -508,12 +514,13 @@
* current subdevice, i.e. at offset zero.
*/
erase->addr = 0;
+ offset += subdev->size;
}
+ instr->state = erase->state;
kfree(erase);
if (err)
return err;
- instr->state = MTD_ERASE_DONE;
if (instr->callback)
instr->callback(instr);
return 0;
More information about the linux-mtd-cvs
mailing list