diff options
author | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2011-06-02 10:00:23 -0400 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@intel.com> | 2011-09-11 08:02:08 -0400 |
commit | ef5d79f1e15ded65af7a75fc464d5dd246a912c7 (patch) | |
tree | 2ec86a7f396cf9ec11e24ed3377b989a99996eab /drivers/mtd/nand/atmel_nand.c | |
parent | e062e2f52fed5bcf65b3228e991771a4a6030d85 (diff) |
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@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/nand/atmel_nand.c')
-rw-r--r-- | 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 47ece8e06e17..b1381437a957 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) | |||
492 | struct resource *regs; | 492 | struct resource *regs; |
493 | struct resource *mem; | 493 | struct resource *mem; |
494 | int res; | 494 | int res; |
495 | struct mtd_partition *partitions = NULL; | ||
496 | int num_partitions = 0; | ||
497 | 495 | ||
498 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 496 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
499 | if (!mem) { | 497 | if (!mem) { |
@@ -652,24 +650,11 @@ static int __init atmel_nand_probe(struct platform_device *pdev) | |||
652 | } | 650 | } |
653 | 651 | ||
654 | mtd->name = "atmel_nand"; | 652 | mtd->name = "atmel_nand"; |
655 | num_partitions = parse_mtd_partitions(mtd, NULL, &partitions, 0); | 653 | res = mtd_device_parse_register(mtd, NULL, 0, |
656 | if (num_partitions <= 0 && host->board->parts) { | 654 | host->board->parts, host->board->num_parts); |
657 | partitions = host->board->parts; | ||
658 | num_partitions = host->board->num_parts; | ||
659 | } | ||
660 | |||
661 | if ((!partitions) || (num_partitions == 0)) { | ||
662 | printk(KERN_ERR "atmel_nand: No partitions defined, or unsupported device.\n"); | ||
663 | res = -ENXIO; | ||
664 | goto err_no_partitions; | ||
665 | } | ||
666 | |||
667 | res = mtd_device_register(mtd, partitions, num_partitions); | ||
668 | if (!res) | 655 | if (!res) |
669 | return res; | 656 | return res; |
670 | 657 | ||
671 | err_no_partitions: | ||
672 | nand_release(mtd); | ||
673 | err_scan_tail: | 658 | err_scan_tail: |
674 | err_scan_ident: | 659 | err_scan_ident: |
675 | err_no_card: | 660 | err_no_card: |