mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
mtd: plat_nand.c: use mtd_device_parse_register
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>
This commit is contained in:
parent
c9dd375f55
commit
009c840770
1 changed files with 3 additions and 19 deletions
|
@ -21,8 +21,6 @@ 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;
|
||||||
int nr_parts;
|
|
||||||
struct mtd_partition *parts;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -100,21 +98,9 @@ static int __devinit plat_nand_probe(struct platform_device *pdev)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pdata->chip.part_probe_types) {
|
err = mtd_device_parse_register(&data->mtd,
|
||||||
err = parse_mtd_partitions(&data->mtd,
|
pdata->chip.part_probe_types, 0,
|
||||||
pdata->chip.part_probe_types,
|
pdata->chip.partitions, pdata->chip.nr_partitions);
|
||||||
&data->parts, 0);
|
|
||||||
if (err > 0) {
|
|
||||||
mtd_device_register(&data->mtd, data->parts, err);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (pdata->chip.partitions) {
|
|
||||||
data->parts = pdata->chip.partitions;
|
|
||||||
err = mtd_device_register(&data->mtd, data->parts,
|
|
||||||
pdata->chip.nr_partitions);
|
|
||||||
} else
|
|
||||||
err = mtd_device_register(&data->mtd, NULL, 0);
|
|
||||||
|
|
||||||
if (!err)
|
if (!err)
|
||||||
return err;
|
return err;
|
||||||
|
@ -144,8 +130,6 @@ 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);
|
||||||
if (data->parts && data->parts != pdata->chip.partitions)
|
|
||||||
kfree(data->parts);
|
|
||||||
if (pdata->ctrl.remove)
|
if (pdata->ctrl.remove)
|
||||||
pdata->ctrl.remove(pdev);
|
pdata->ctrl.remove(pdev);
|
||||||
iounmap(data->io_base);
|
iounmap(data->io_base);
|
||||||
|
|
Loading…
Add table
Reference in a new issue