mtd: onenand/omap2.c: use mtd_device_parse_register

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Nov 7 11:59:18 EST 2011


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=7d010d2e772e16ef35a9bc6d706ec1e40eac9f46
Commit:     7d010d2e772e16ef35a9bc6d706ec1e40eac9f46
Parent:     92ffb00d11b24e69cc87a0c0aa5de172d9de8e13
Author:     Dmitry Eremin-Solenikov <dbaryshkov at gmail.com>
AuthorDate: Thu Jun 2 18:01:11 2011 +0400
Committer:  Artem Bityutskiy <artem.bityutskiy at intel.com>
CommitDate: Sun Sep 11 15:02:10 2011 +0300

    mtd: onenand/omap2.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.
    
    Axel Lin <axel.lin at gmail.com>: fixed build breakage
    
    Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov at gmail.com>
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
---
 drivers/mtd/onenand/omap2.c |   13 +++----------
 1 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c
index 5ca2053..06efa14 100644
--- a/drivers/mtd/onenand/omap2.c
+++ b/drivers/mtd/onenand/omap2.c
@@ -57,7 +57,6 @@ struct omap2_onenand {
 	unsigned long phys_base;
 	int gpio_irq;
 	struct mtd_info mtd;
-	struct mtd_partition *parts;
 	struct onenand_chip onenand;
 	struct completion irq_done;
 	struct completion dma_done;
@@ -752,13 +751,9 @@ static int __devinit omap2_onenand_probe(struct platform_device *pdev)
 	if ((r = onenand_scan(&c->mtd, 1)) < 0)
 		goto err_release_regulator;
 
-	r = parse_mtd_partitions(&c->mtd, NULL, &c->parts, 0);
-	if (r > 0)
-		r = mtd_device_register(&c->mtd, c->parts, r);
-	else if (pdata->parts != NULL)
-		r = mtd_device_register(&c->mtd, pdata->parts, pdata->nr_parts);
-	else
-		r = mtd_device_register(&c->mtd, NULL, 0);
+	r = mtd_device_parse_register(&c->mtd, NULL, 0,
+			pdata ? pdata->parts : NULL,
+			pdata ? pdata->nr_parts : 0);
 	if (r)
 		goto err_release_onenand;
 
@@ -785,7 +780,6 @@ err_release_mem_region:
 err_free_cs:
 	gpmc_cs_free(c->gpmc_cs);
 err_kfree:
-	kfree(c->parts);
 	kfree(c);
 
 	return r;
@@ -808,7 +802,6 @@ static int __devexit omap2_onenand_remove(struct platform_device *pdev)
 	iounmap(c->onenand.base);
 	release_mem_region(c->phys_base, ONENAND_IO_SIZE);
 	gpmc_cs_free(c->gpmc_cs);
-	kfree(c->parts);
 	kfree(c);
 
 	return 0;



More information about the linux-mtd-cvs mailing list