[MTD] [NAND] S3C2410: Allow commandline partition processing

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Jun 8 07:59:02 EDT 2009


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=ed27f0287062236d50190d7447f6377ff4acdfad
Commit:     ed27f0287062236d50190d7447f6377ff4acdfad
Parent:     ae7304e554642d57993b32265b817e6ae80787de
Author:     Andy Green <andy at warmcat.com>
AuthorDate: Sun May 10 15:42:09 2009 -0500
Committer:  Ben Dooks <ben-linux at fluff.org>
CommitDate: Sat May 30 18:01:10 2009 +0100

    [MTD] [NAND] S3C2410: Allow commandline partition processing
    
    This patch allows commandline partition processing to
    work with the s3c2410 NAND platform driver.
    
    Signed-off-by: Andy Green <andy at warcat.com>
    Signed-off-by: Nelson Castillo <arhuaco at freaks-unidos.net>
    [ben-linux at fluff.org: Change andy at openmoko.com to andy at warmcat.com]
    Signed-off-by: Ben Dooks <ben-linux at fluff.org>
---
 drivers/mtd/nand/s3c2410.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index 87c40de..ef56652 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -699,17 +699,31 @@ static int s3c24xx_nand_remove(struct platform_device *pdev)
 }
 
 #ifdef CONFIG_MTD_PARTITIONS
+const char *part_probes[] = { "cmdlinepart", NULL };
 static int s3c2410_nand_add_partition(struct s3c2410_nand_info *info,
 				      struct s3c2410_nand_mtd *mtd,
 				      struct s3c2410_nand_set *set)
 {
+	struct mtd_partition *part_info;
+	int nr_part = 0;
+
 	if (set == NULL)
 		return add_mtd_device(&mtd->mtd);
 
-	if (set->nr_partitions > 0 && set->partitions != NULL) {
-		return add_mtd_partitions(&mtd->mtd, set->partitions, set->nr_partitions);
+	if (set->nr_partitions == 0) {
+		mtd->mtd.name = set->name;
+		nr_part = parse_mtd_partitions(&mtd->mtd, part_probes,
+						&part_info, 0);
+	} else {
+		if (set->nr_partitions > 0 && set->partitions != NULL) {
+			nr_part = set->nr_partitions;
+			part_info = set->partitions;
+		}
 	}
 
+	if (nr_part > 0 && part_info)
+		return add_mtd_partitions(&mtd->mtd, part_info, nr_part);
+
 	return add_mtd_device(&mtd->mtd);
 }
 #else



More information about the linux-mtd-cvs mailing list