mtd: intel_vr_nor: convert to mtd_device_register()
authorJamie Iles <jamie@jamieiles.com>
Mon, 23 May 2011 09:23:05 +0000 (10:23 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Wed, 25 May 2011 01:21:51 +0000 (02:21 +0100)
Convert to mtd_device_register() and remove the CONFIG_MTD_PARTITIONS
preprocessor conditionals as partitioning is always available.

Signed-off-by: Jamie Iles <jamie@jamieiles.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/maps/intel_vr_nor.c

index fc1998512eb407bd26e9cf235cbf8a2f92ecfa26..d2f47be8754b211392c0841fd32685396878481a 100644 (file)
@@ -66,33 +66,18 @@ struct vr_nor_mtd {
 
 static void __devexit vr_nor_destroy_partitions(struct vr_nor_mtd *p)
 {
-       if (p->nr_parts > 0) {
-#if defined(CONFIG_MTD_PARTITIONS) || defined(CONFIG_MTD_PARTITIONS_MODULE)
-               del_mtd_partitions(p->info);
-#endif
-       } else
-               del_mtd_device(p->info);
+       mtd_device_unregister(p->info);
 }
 
 static int __devinit vr_nor_init_partitions(struct vr_nor_mtd *p)
 {
-       int err = 0;
-#if defined(CONFIG_MTD_PARTITIONS) || defined(CONFIG_MTD_PARTITIONS_MODULE)
        struct mtd_partition *parts;
        static const char *part_probes[] = { "cmdlinepart", NULL };
-#endif
 
        /* register the flash bank */
-#if defined(CONFIG_MTD_PARTITIONS) || defined(CONFIG_MTD_PARTITIONS_MODULE)
        /* partition the flash bank */
        p->nr_parts = parse_mtd_partitions(p->info, part_probes, &parts, 0);
-       if (p->nr_parts > 0)
-               err = add_mtd_partitions(p->info, parts, p->nr_parts);
-#endif
-       if (p->nr_parts <= 0)
-               err = add_mtd_device(p->info);
-
-       return err;
+       return mtd_device_register(p->info, parts, p->nr_parts);
 }
 
 static void __devexit vr_nor_destroy_mtd_setup(struct vr_nor_mtd *p)