mtd: socrates_nand: use ofpart through generic parsing
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Sun, 29 May 2011 21:02:26 +0000 (01:02 +0400)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Sun, 11 Sep 2011 12:02:11 +0000 (15:02 +0300)
Convert the driver to use ofpart partitions parsing through the generic
parse_mtd_partitions().

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
drivers/mtd/nand/socrates_nand.c

index 9023ac833fcf4298bb0d1b07b15b983b405417bb..f4f79ecb5ba39a4f0be30ca36d69d5194ea84b13 100644 (file)
@@ -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;