Commit 09877115 authored by Jamie Iles's avatar Jamie Iles Committed by David Woodhouse

mtd: davinci_nand: convert to mtd_device_register()

Convert to mtd_device_register() and remove the check for
mtd_has_partitions() 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 a17f7ca5
...@@ -530,6 +530,8 @@ static int __init nand_davinci_probe(struct platform_device *pdev) ...@@ -530,6 +530,8 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
int ret; int ret;
uint32_t val; uint32_t val;
nand_ecc_modes_t ecc_mode; nand_ecc_modes_t ecc_mode;
struct mtd_partition *mtd_parts = NULL;
int mtd_parts_nb = 0;
/* insist on board-specific configuration */ /* insist on board-specific configuration */
if (!pdata) if (!pdata)
...@@ -749,41 +751,33 @@ static int __init nand_davinci_probe(struct platform_device *pdev) ...@@ -749,41 +751,33 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
if (ret < 0) if (ret < 0)
goto err_scan; goto err_scan;
if (mtd_has_partitions()) { if (mtd_has_cmdlinepart()) {
struct mtd_partition *mtd_parts = NULL; static const char *probes[] __initconst = {
int mtd_parts_nb = 0; "cmdlinepart", NULL
};
if (mtd_has_cmdlinepart()) { mtd_parts_nb = parse_mtd_partitions(&info->mtd, probes,
static const char *probes[] __initconst = &mtd_parts, 0);
{ "cmdlinepart", NULL }; }
mtd_parts_nb = parse_mtd_partitions(&info->mtd, probes,
&mtd_parts, 0);
}
if (mtd_parts_nb <= 0) {
mtd_parts = pdata->parts;
mtd_parts_nb = pdata->nr_parts;
}
/* Register any partitions */ if (mtd_parts_nb <= 0) {
if (mtd_parts_nb > 0) { mtd_parts = pdata->parts;
ret = add_mtd_partitions(&info->mtd, mtd_parts_nb = pdata->nr_parts;
mtd_parts, mtd_parts_nb); }
if (ret == 0)
info->partitioned = true;
}
} else if (pdata->nr_parts) { /* Register any partitions */
dev_warn(&pdev->dev, "ignoring %d default partitions on %s\n", if (mtd_parts_nb > 0) {
pdata->nr_parts, info->mtd.name); ret = mtd_device_register(&info->mtd, mtd_parts,
mtd_parts_nb);
if (ret == 0)
info->partitioned = true;
} }
/* If there's no partition info, just package the whole chip /* If there's no partition info, just package the whole chip
* as a single MTD device. * as a single MTD device.
*/ */
if (!info->partitioned) if (!info->partitioned)
ret = add_mtd_device(&info->mtd) ? -ENODEV : 0; ret = mtd_device_register(&info->mtd, NULL, 0) ? -ENODEV : 0;
if (ret < 0) if (ret < 0)
goto err_scan; goto err_scan;
...@@ -824,10 +818,7 @@ static int __exit nand_davinci_remove(struct platform_device *pdev) ...@@ -824,10 +818,7 @@ static int __exit nand_davinci_remove(struct platform_device *pdev)
struct davinci_nand_info *info = platform_get_drvdata(pdev); struct davinci_nand_info *info = platform_get_drvdata(pdev);
int status; int status;
if (mtd_has_partitions() && info->partitioned) status = mtd_device_unregister(&info->mtd);
status = del_mtd_partitions(&info->mtd);
else
status = del_mtd_device(&info->mtd);
spin_lock_irq(&davinci_nand_lock); spin_lock_irq(&davinci_nand_lock);
if (info->chip.ecc.mode == NAND_ECC_HW_SYNDROME) if (info->chip.ecc.mode == NAND_ECC_HW_SYNDROME)
......
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