[MTD] Remove option for add_mtd_partitions() to not register partitions.

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Tue May 26 11:59:02 EDT 2009


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=b90cf6681f4f6263920616e7ca2fd09130e4143a
Commit:     b90cf6681f4f6263920616e7ca2fd09130e4143a
Parent:     4704a78472cd5c58f6b4c4f8c04d32de2da3f20a
Author:     David Woodhouse <David.Woodhouse at intel.com>
AuthorDate: Sun Apr 5 08:23:44 2009 -0700
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Tue May 26 16:45:44 2009 +0100

    [MTD] Remove option for add_mtd_partitions() to not register partitions.
    
    This breaks the dilnetpc map driver, but it could be fixed not to use
    that option. We want to simplify the partition handling, and this is a
    step towards that.
    
    Remove superfluous 'index' field from private struct mtd_part too, while
    we're at it.
    
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/mtdpart.c          |   18 ++++--------------
 include/linux/mtd/partitions.h |    1 -
 2 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 63d1cd2..349fcbe 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -27,9 +27,7 @@ struct mtd_part {
 	struct mtd_info mtd;
 	struct mtd_info *master;
 	uint64_t offset;
-	int index;
 	struct list_head list;
-	int registered;
 };
 
 /*
@@ -321,8 +319,7 @@ int del_mtd_partitions(struct mtd_info *master)
 	list_for_each_entry_safe(slave, next, &mtd_partitions, list)
 		if (slave->master == master) {
 			list_del(&slave->list);
-			if (slave->registered)
-				del_mtd_device(&slave->mtd);
+			del_mtd_device(&slave->mtd);
 			kfree(slave);
 		}
 
@@ -412,7 +409,6 @@ static struct mtd_part *add_one_partition(struct mtd_info *master,
 	slave->mtd.erase = part_erase;
 	slave->master = master;
 	slave->offset = part->offset;
-	slave->index = partno;
 
 	if (slave->offset == MTDPART_OFS_APPEND)
 		slave->offset = cur_offset;
@@ -500,15 +496,9 @@ static struct mtd_part *add_one_partition(struct mtd_info *master,
 	}
 
 out_register:
-	if (part->mtdp) {
-		/* store the object pointer (caller may or may not register it*/
-		*part->mtdp = &slave->mtd;
-		slave->registered = 0;
-	} else {
-		/* register our partition */
-		add_mtd_device(&slave->mtd);
-		slave->registered = 1;
-	}
+	/* register our partition */
+	add_mtd_device(&slave->mtd);
+
 	return slave;
 }
 
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
index 7535a74..af6dcb9 100644
--- a/include/linux/mtd/partitions.h
+++ b/include/linux/mtd/partitions.h
@@ -40,7 +40,6 @@ struct mtd_partition {
 	uint64_t offset;		/* offset within the master MTD space */
 	uint32_t mask_flags;		/* master MTD flags to mask out for this partition */
 	struct nand_ecclayout *ecclayout;	/* out of band layout for this partition (NAND only)*/
-	struct mtd_info **mtdp;		/* pointer to store the MTD object */
 };
 
 #define MTDPART_OFS_NXTBLK	(-2)



More information about the linux-mtd-cvs mailing list