mtd: s3c2410.c: use mtd_device_parse_register
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Thu, 2 Jun 2011 14:01:02 +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/s3c2410.c

index 17954baf12cd15fe0a221eb38400728943306dbe..b0f8e77834fe62470ce246871a19dd8bd75a895b 100644 (file)
@@ -748,21 +748,11 @@ 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)
+               mtd->mtd.name = set->name;
 
-       if (set == NULL)
-               return mtd_device_register(&mtd->mtd, NULL, 0);
-
-       mtd->mtd.name = set->name;
-       nr_part = parse_mtd_partitions(&mtd->mtd, NULL, &part_info, 0);
-
-       if (nr_part <= 0 && set->nr_partitions > 0) {
-               nr_part = set->nr_partitions;
-               part_info = set->partitions;
-       }
-
-       return mtd_device_register(&mtd->mtd, part_info, nr_part);
+       return mtd_device_parse_register(&mtd->mtd, NULL, 0,
+                       set->partitions, set->nr_partitions);
 }
 
 /**