Commit 95bf224f authored by Jamie Iles's avatar Jamie Iles Committed by David Woodhouse

mtd: intel_vr_nor: convert to mtd_device_register()

Convert to mtd_device_register() and remove the CONFIG_MTD_PARTITIONS
preprocessor conditionals as partitioning is always available.
Signed-off-by: default avatarJamie Iles <jamie@jamieiles.com>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 96b639fd
...@@ -66,33 +66,18 @@ struct vr_nor_mtd { ...@@ -66,33 +66,18 @@ struct vr_nor_mtd {
static void __devexit vr_nor_destroy_partitions(struct vr_nor_mtd *p) static void __devexit vr_nor_destroy_partitions(struct vr_nor_mtd *p)
{ {
if (p->nr_parts > 0) { mtd_device_unregister(p->info);
#if defined(CONFIG_MTD_PARTITIONS) || defined(CONFIG_MTD_PARTITIONS_MODULE)
del_mtd_partitions(p->info);
#endif
} else
del_mtd_device(p->info);
} }
static int __devinit vr_nor_init_partitions(struct vr_nor_mtd *p) 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; struct mtd_partition *parts;
static const char *part_probes[] = { "cmdlinepart", NULL }; static const char *part_probes[] = { "cmdlinepart", NULL };
#endif
/* register the flash bank */ /* register the flash bank */
#if defined(CONFIG_MTD_PARTITIONS) || defined(CONFIG_MTD_PARTITIONS_MODULE)
/* partition the flash bank */ /* partition the flash bank */
p->nr_parts = parse_mtd_partitions(p->info, part_probes, &parts, 0); p->nr_parts = parse_mtd_partitions(p->info, part_probes, &parts, 0);
if (p->nr_parts > 0) return mtd_device_register(p->info, parts, p->nr_parts);
err = add_mtd_partitions(p->info, parts, p->nr_parts);
#endif
if (p->nr_parts <= 0)
err = add_mtd_device(p->info);
return err;
} }
static void __devexit vr_nor_destroy_mtd_setup(struct vr_nor_mtd *p) static void __devexit vr_nor_destroy_mtd_setup(struct vr_nor_mtd *p)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment