mtd: socrates_nand: use ofpart through generic parsing

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Nov 7 11:59:21 EST 2011


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=2cd9ea5256ecf2bc795d476598ac7f43f4b83a97
Commit:     2cd9ea5256ecf2bc795d476598ac7f43f4b83a97
Parent:     9d7948c50055e74b693ce9e99a709b2e5bbc1942
Author:     Dmitry Eremin-Solenikov <dbaryshkov at gmail.com>
AuthorDate: Mon May 30 01:02:26 2011 +0400
Committer:  Artem Bityutskiy <artem.bityutskiy at intel.com>
CommitDate: Sun Sep 11 15:02:11 2011 +0300

    mtd: socrates_nand: use ofpart through generic parsing
    
    Convert the driver to use ofpart partitions parsing through the generic
    parse_mtd_partitions().
    
    Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov at gmail.com>
    Signed-off-by: Artem Bityutskiy <dedekind1 at gmail.com>
---
 drivers/mtd/nand/socrates_nand.c |   14 +++-----------
 1 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/mtd/nand/socrates_nand.c b/drivers/mtd/nand/socrates_nand.c
index 9023ac8..f4f79ec 100644
--- a/drivers/mtd/nand/socrates_nand.c
+++ b/drivers/mtd/nand/socrates_nand.c
@@ -166,6 +166,7 @@ static int __devinit socrates_nand_probe(struct platform_device *ofdev)
 	int res;
 	struct mtd_partition *partitions = NULL;
 	int num_partitions = 0;
+	struct mtd_part_parser_data ppdata;
 
 	/* Allocate memory for the device structure (and zero it) */
 	host = kzalloc(sizeof(struct socrates_nand_host), GFP_KERNEL);
@@ -191,6 +192,7 @@ static int __devinit socrates_nand_probe(struct platform_device *ofdev)
 	mtd->name = "socrates_nand";
 	mtd->owner = THIS_MODULE;
 	mtd->dev.parent = &ofdev->dev;
+	ppdata.of_node = ofdev->dev.of_node;
 
 	/*should never be accessed directly */
 	nand_chip->IO_ADDR_R = (void *)0xdeadbeef;
@@ -223,22 +225,12 @@ static int __devinit socrates_nand_probe(struct platform_device *ofdev)
 		goto out;
 	}
 
-	num_partitions = parse_mtd_partitions(mtd, NULL, &partitions, 0);
+	num_partitions = parse_mtd_partitions(mtd, NULL, &partitions, &ppdata);
 	if (num_partitions < 0) {
 		res = num_partitions;
 		goto release;
 	}
 
-	if (num_partitions == 0) {
-		num_partitions = of_mtd_parse_partitions(&ofdev->dev,
-							 ofdev->dev.of_node,
-							 &partitions);
-		if (num_partitions < 0) {
-			res = num_partitions;
-			goto release;
-		}
-	}
-
 	res = mtd_device_register(mtd, partitions, num_partitions);
 	if (!res)
 		return res;



More information about the linux-mtd-cvs mailing list