Commit 711a632d authored by Jamie Iles's avatar Jamie Iles Committed by David Woodhouse

mtd: onenand: convert to mtd_device_register()

Convert to mtd_device_register() and remove the CONFIG_MTD_PARTITIONS
preprocessor conditionals as partitioning is always available.

Cc: Kyungmin Park <kyungmin.park@samsung.com>
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 47854888
menuconfig MTD_ONENAND menuconfig MTD_ONENAND
tristate "OneNAND Device Support" tristate "OneNAND Device Support"
depends on MTD depends on MTD
select MTD_PARTITIONS
help help
This enables support for accessing all type of OneNAND flash This enables support for accessing all type of OneNAND flash
devices. For further information see devices. For further information see
......
...@@ -30,9 +30,7 @@ ...@@ -30,9 +30,7 @@
*/ */
#define DRIVER_NAME "onenand-flash" #define DRIVER_NAME "onenand-flash"
#ifdef CONFIG_MTD_PARTITIONS
static const char *part_probes[] = { "cmdlinepart", NULL, }; static const char *part_probes[] = { "cmdlinepart", NULL, };
#endif
struct onenand_info { struct onenand_info {
struct mtd_info mtd; struct mtd_info mtd;
...@@ -75,15 +73,13 @@ static int __devinit generic_onenand_probe(struct platform_device *pdev) ...@@ -75,15 +73,13 @@ static int __devinit generic_onenand_probe(struct platform_device *pdev)
goto out_iounmap; goto out_iounmap;
} }
#ifdef CONFIG_MTD_PARTITIONS
err = parse_mtd_partitions(&info->mtd, part_probes, &info->parts, 0); err = parse_mtd_partitions(&info->mtd, part_probes, &info->parts, 0);
if (err > 0) if (err > 0)
add_mtd_partitions(&info->mtd, info->parts, err); mtd_device_register(&info->mtd, info->parts, err);
else if (err <= 0 && pdata && pdata->parts) else if (err <= 0 && pdata && pdata->parts)
add_mtd_partitions(&info->mtd, pdata->parts, pdata->nr_parts); mtd_device_register(&info->mtd, pdata->parts, pdata->nr_parts);
else else
#endif err = mtd_device_register(&info->mtd, NULL, 0);
err = add_mtd_device(&info->mtd);
platform_set_drvdata(pdev, info); platform_set_drvdata(pdev, info);
...@@ -108,11 +104,7 @@ static int __devexit generic_onenand_remove(struct platform_device *pdev) ...@@ -108,11 +104,7 @@ static int __devexit generic_onenand_remove(struct platform_device *pdev)
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
if (info) { if (info) {
if (info->parts) mtd_device_unregister(&info->mtd);
del_mtd_partitions(&info->mtd);
else
del_mtd_device(&info->mtd);
onenand_release(&info->mtd); onenand_release(&info->mtd);
release_mem_region(res->start, size); release_mem_region(res->start, size);
iounmap(info->onenand.base); iounmap(info->onenand.base);
......
...@@ -4142,12 +4142,8 @@ void onenand_release(struct mtd_info *mtd) ...@@ -4142,12 +4142,8 @@ void onenand_release(struct mtd_info *mtd)
{ {
struct onenand_chip *this = mtd->priv; struct onenand_chip *this = mtd->priv;
#ifdef CONFIG_MTD_PARTITIONS
/* Deregister partitions */ /* Deregister partitions */
del_mtd_partitions (mtd); mtd_device_unregister(mtd);
#endif
/* Deregister the device */
del_mtd_device (mtd);
/* Free bad block table memory, if allocated */ /* Free bad block table memory, if allocated */
if (this->bbm) { if (this->bbm) {
......
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