Commit d4ed8f12 authored by Dmitry Eremin-Solenikov's avatar Dmitry Eremin-Solenikov Committed by Artem Bityutskiy

mtd: mxc_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: default avatarDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
parent 90ee1fb3
...@@ -143,7 +143,6 @@ ...@@ -143,7 +143,6 @@
struct mxc_nand_host { struct mxc_nand_host {
struct mtd_info mtd; struct mtd_info mtd;
struct nand_chip nand; struct nand_chip nand;
struct mtd_partition *parts;
struct device *dev; struct device *dev;
void *spare0; void *spare0;
...@@ -1044,7 +1043,7 @@ static int __init mxcnd_probe(struct platform_device *pdev) ...@@ -1044,7 +1043,7 @@ static int __init mxcnd_probe(struct platform_device *pdev)
struct mxc_nand_platform_data *pdata = pdev->dev.platform_data; struct mxc_nand_platform_data *pdata = pdev->dev.platform_data;
struct mxc_nand_host *host; struct mxc_nand_host *host;
struct resource *res; struct resource *res;
int err = 0, __maybe_unused nr_parts = 0; int err = 0;
struct nand_ecclayout *oob_smallpage, *oob_largepage; struct nand_ecclayout *oob_smallpage, *oob_largepage;
/* Allocate memory for MTD device structure and private data */ /* Allocate memory for MTD device structure and private data */
...@@ -1231,16 +1230,8 @@ static int __init mxcnd_probe(struct platform_device *pdev) ...@@ -1231,16 +1230,8 @@ static int __init mxcnd_probe(struct platform_device *pdev)
} }
/* Register the partitions */ /* Register the partitions */
nr_parts = mtd_device_parse_register(mtd, part_probes, 0,
parse_mtd_partitions(mtd, part_probes, &host->parts, 0); pdata->parts, pdata->nr_parts);
if (nr_parts > 0)
mtd_device_register(mtd, host->parts, nr_parts);
else if (pdata->parts)
mtd_device_register(mtd, pdata->parts, pdata->nr_parts);
else {
pr_info("Registering %s as whole device\n", mtd->name);
mtd_device_register(mtd, NULL, 0);
}
platform_set_drvdata(pdev, host); platform_set_drvdata(pdev, host);
......
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