mtd/drivers/mtd mtdpart.c,1.29,1.30

Joakim Tjernlund jocke at infradead.org
Thu Sep 5 16:24:48 EDT 2002


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

Modified Files:
	mtdpart.c 
Log Message:
Added point()/unpoint()

Index: mtdpart.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdpart.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- mtdpart.c	29 Aug 2002 21:46:43 -0000	1.29
+++ mtdpart.c	5 Sep 2002 20:24:46 -0000	1.30
@@ -58,6 +58,25 @@
 					len, retlen, buf);
 }
 
+static int part_point (struct mtd_info *mtd, loff_t from, size_t len, 
+			size_t *retlen, u_char **buf)
+{
+	struct mtd_part *part = PART(mtd);
+	if (from >= mtd->size)
+		len = 0;
+	else if (from + len > mtd->size)
+		len = mtd->size - from;
+	return part->master->point (part->master, from + part->offset, 
+				    len, retlen, buf);
+}
+static void part_unpoint (struct mtd_info *mtd, u_char *addr)
+{
+	struct mtd_part *part = PART(mtd);
+
+	part->master->unpoint (part->master, ((unsigned long) addr) - part->offset);
+}
+
+
 static int part_read_ecc (struct mtd_info *mtd, loff_t from, size_t len, 
 			size_t *retlen, u_char *buf, u_char *eccbuf, int oobsel)
 {
@@ -306,6 +325,11 @@
 
 		slave->mtd.read = part_read;
 		slave->mtd.write = part_write;
+
+		if(master->point && master->unpoint){
+			slave->mtd.point = part_point;
+			slave->mtd.unpoint = part_unpoint;
+		}
 		
 		if (master->read_ecc)
 			slave->mtd.read_ecc = part_read_ecc;





More information about the linux-mtd-cvs mailing list