Commit 902766bf authored by Jamie Iles's avatar Jamie Iles Committed by David Woodhouse

mtd: latch-addr-flash: 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 95bf224f
...@@ -112,18 +112,9 @@ static int latch_addr_flash_remove(struct platform_device *dev) ...@@ -112,18 +112,9 @@ static int latch_addr_flash_remove(struct platform_device *dev)
latch_addr_data = dev->dev.platform_data; latch_addr_data = dev->dev.platform_data;
if (info->mtd != NULL) { if (info->mtd != NULL) {
if (mtd_has_partitions()) { if (info->nr_parts)
if (info->nr_parts) { kfree(info->parts);
del_mtd_partitions(info->mtd); mtd_device_unregister(info->mtd);
kfree(info->parts);
} else if (latch_addr_data->nr_parts) {
del_mtd_partitions(info->mtd);
} else {
del_mtd_device(info->mtd);
}
} else {
del_mtd_device(info->mtd);
}
map_destroy(info->mtd); map_destroy(info->mtd);
} }
...@@ -215,23 +206,21 @@ static int __devinit latch_addr_flash_probe(struct platform_device *dev) ...@@ -215,23 +206,21 @@ static int __devinit latch_addr_flash_probe(struct platform_device *dev)
} }
info->mtd->owner = THIS_MODULE; info->mtd->owner = THIS_MODULE;
if (mtd_has_partitions()) { err = parse_mtd_partitions(info->mtd, (const char **)part_probe_types,
&info->parts, 0);
err = parse_mtd_partitions(info->mtd, if (err > 0) {
(const char **)part_probe_types, mtd_device_register(info->mtd, info->parts, err);
&info->parts, 0); return 0;
if (err > 0) { }
add_mtd_partitions(info->mtd, info->parts, err); if (latch_addr_data->nr_parts) {
return 0; pr_notice("Using latch-addr-flash partition information\n");
} mtd_device_register(info->mtd,
if (latch_addr_data->nr_parts) { latch_addr_data->parts,
pr_notice("Using latch-addr-flash partition information\n"); latch_addr_data->nr_parts);
add_mtd_partitions(info->mtd, latch_addr_data->parts, return 0;
latch_addr_data->nr_parts);
return 0;
}
} }
add_mtd_device(info->mtd);
mtd_device_register(info->mtd, NULL, 0);
return 0; return 0;
iounmap: iounmap:
......
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