mtd: tmio_nand.c: use mtd_device_parse_register
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Thu, 2 Jun 2011 14:01:09 +0000 (18:01 +0400)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Sun, 11 Sep 2011 12:02:09 +0000 (15:02 +0300)
Replace custom invocations of parse_mtd_partitions and mtd_device_register
with common mtd_device_parse_register call. This would bring: standard
handling of all errors, fallback to default partitions, etc.

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

index b6ffad64cda5b5128e4fbe816fb95f173909ed40..beebd95f76907de7e32102d0dd9a7593be99d0a7 100644 (file)
@@ -378,8 +378,6 @@ static int tmio_probe(struct platform_device *dev)
        struct tmio_nand *tmio;
        struct mtd_info *mtd;
        struct nand_chip *nand_chip;
-       struct mtd_partition *parts;
-       int nbparts = 0;
        int retval;
 
        if (data == NULL)
@@ -458,13 +456,9 @@ static int tmio_probe(struct platform_device *dev)
                goto err_scan;
        }
        /* Register the partitions */
-       nbparts = parse_mtd_partitions(mtd, NULL, &parts, 0);
-       if (nbparts <= 0 && data) {
-               parts = data->partition;
-               nbparts = data->num_partitions;
-       }
-
-       retval = mtd_device_register(mtd, parts, nbparts);
+       retval = mtd_device_parse_register(mtd, NULL, 0,
+                       data ? data->partition : NULL,
+                       data ? data->num_partitions : 0);
        if (!retval)
                return retval;