mtd: atmel_nand.c: use mtd_device_parse_register

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


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

    mtd: atmel_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 at gmail.com>
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
---
 drivers/mtd/nand/atmel_nand.c |   19 ++-----------------
 1 files changed, 2 insertions(+), 17 deletions(-)

diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 47ece8e..b138143 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -492,8 +492,6 @@ static int __init atmel_nand_probe(struct platform_device *pdev)
 	struct resource *regs;
 	struct resource *mem;
 	int res;
-	struct mtd_partition *partitions = NULL;
-	int num_partitions = 0;
 
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!mem) {
@@ -652,24 +650,11 @@ static int __init atmel_nand_probe(struct platform_device *pdev)
 	}
 
 	mtd->name = "atmel_nand";
-	num_partitions = parse_mtd_partitions(mtd, NULL, &partitions, 0);
-	if (num_partitions <= 0 && host->board->parts) {
-		partitions = host->board->parts;
-		num_partitions = host->board->num_parts;
-	}
-
-	if ((!partitions) || (num_partitions == 0)) {
-		printk(KERN_ERR "atmel_nand: No partitions defined, or unsupported device.\n");
-		res = -ENXIO;
-		goto err_no_partitions;
-	}
-
-	res = mtd_device_register(mtd, partitions, num_partitions);
+	res = mtd_device_parse_register(mtd, NULL, 0,
+			host->board->parts, host->board->num_parts);
 	if (!res)
 		return res;
 
-err_no_partitions:
-	nand_release(mtd);
 err_scan_tail:
 err_scan_ident:
 err_no_card:



More information about the linux-mtd-cvs mailing list