Commit 3ee904f2 authored by Jamie Iles's avatar Jamie Iles Committed by David Woodhouse

mtd: plat_nand: 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 5ffcaf3d
...@@ -21,10 +21,8 @@ struct plat_nand_data { ...@@ -21,10 +21,8 @@ struct plat_nand_data {
struct nand_chip chip; struct nand_chip chip;
struct mtd_info mtd; struct mtd_info mtd;
void __iomem *io_base; void __iomem *io_base;
#ifdef CONFIG_MTD_PARTITIONS
int nr_parts; int nr_parts;
struct mtd_partition *parts; struct mtd_partition *parts;
#endif
}; };
/* /*
...@@ -101,13 +99,12 @@ static int __devinit plat_nand_probe(struct platform_device *pdev) ...@@ -101,13 +99,12 @@ static int __devinit plat_nand_probe(struct platform_device *pdev)
goto out; goto out;
} }
#ifdef CONFIG_MTD_PARTITIONS
if (pdata->chip.part_probe_types) { if (pdata->chip.part_probe_types) {
err = parse_mtd_partitions(&data->mtd, err = parse_mtd_partitions(&data->mtd,
pdata->chip.part_probe_types, pdata->chip.part_probe_types,
&data->parts, 0); &data->parts, 0);
if (err > 0) { if (err > 0) {
add_mtd_partitions(&data->mtd, data->parts, err); mtd_device_register(&data->mtd, data->parts, err);
return 0; return 0;
} }
} }
...@@ -115,11 +112,10 @@ static int __devinit plat_nand_probe(struct platform_device *pdev) ...@@ -115,11 +112,10 @@ static int __devinit plat_nand_probe(struct platform_device *pdev)
pdata->chip.set_parts(data->mtd.size, &pdata->chip); pdata->chip.set_parts(data->mtd.size, &pdata->chip);
if (pdata->chip.partitions) { if (pdata->chip.partitions) {
data->parts = pdata->chip.partitions; data->parts = pdata->chip.partitions;
err = add_mtd_partitions(&data->mtd, data->parts, err = mtd_device_register(&data->mtd, data->parts,
pdata->chip.nr_partitions); pdata->chip.nr_partitions);
} else } else
#endif err = mtd_device_register(&data->mtd, NULL, 0);
err = add_mtd_device(&data->mtd);
if (!err) if (!err)
return err; return err;
...@@ -149,10 +145,8 @@ static int __devexit plat_nand_remove(struct platform_device *pdev) ...@@ -149,10 +145,8 @@ static int __devexit plat_nand_remove(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
nand_release(&data->mtd); nand_release(&data->mtd);
#ifdef CONFIG_MTD_PARTITIONS
if (data->parts && data->parts != pdata->chip.partitions) if (data->parts && data->parts != pdata->chip.partitions)
kfree(data->parts); kfree(data->parts);
#endif
if (pdata->ctrl.remove) if (pdata->ctrl.remove)
pdata->ctrl.remove(pdev); pdata->ctrl.remove(pdev);
iounmap(data->io_base); iounmap(data->io_base);
......
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