diff options
author | Jamie Iles <jamie@jamieiles.com> | 2011-05-23 05:23:18 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2011-05-24 21:23:20 -0400 |
commit | 098771158813fb391dd6c1c8b907599db91fb0c7 (patch) | |
tree | 38fd63199da96569e91f6daa8147fd62a258e425 /drivers/mtd | |
parent | a17f7ca510035beee7527f352b3a46fe5dcabce1 (diff) |
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: Jamie Iles <jamie@jamieiles.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/davinci_nand.c | 51 |
1 files changed, 21 insertions, 30 deletions
diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c index aff3468867ac..1f34951ae1a7 100644 --- a/drivers/mtd/nand/davinci_nand.c +++ b/drivers/mtd/nand/davinci_nand.c | |||
@@ -530,6 +530,8 @@ static int __init nand_davinci_probe(struct platform_device *pdev) | |||
530 | int ret; | 530 | int ret; |
531 | uint32_t val; | 531 | uint32_t val; |
532 | nand_ecc_modes_t ecc_mode; | 532 | nand_ecc_modes_t ecc_mode; |
533 | struct mtd_partition *mtd_parts = NULL; | ||
534 | int mtd_parts_nb = 0; | ||
533 | 535 | ||
534 | /* insist on board-specific configuration */ | 536 | /* insist on board-specific configuration */ |
535 | if (!pdata) | 537 | if (!pdata) |
@@ -749,41 +751,33 @@ syndrome_done: | |||
749 | if (ret < 0) | 751 | if (ret < 0) |
750 | goto err_scan; | 752 | goto err_scan; |
751 | 753 | ||
752 | if (mtd_has_partitions()) { | 754 | if (mtd_has_cmdlinepart()) { |
753 | struct mtd_partition *mtd_parts = NULL; | 755 | static const char *probes[] __initconst = { |
754 | int mtd_parts_nb = 0; | 756 | "cmdlinepart", NULL |
757 | }; | ||
755 | 758 | ||
756 | if (mtd_has_cmdlinepart()) { | 759 | mtd_parts_nb = parse_mtd_partitions(&info->mtd, probes, |
757 | static const char *probes[] __initconst = | 760 | &mtd_parts, 0); |
758 | { "cmdlinepart", NULL }; | 761 | } |
759 | |||
760 | mtd_parts_nb = parse_mtd_partitions(&info->mtd, probes, | ||
761 | &mtd_parts, 0); | ||
762 | } | ||
763 | |||
764 | if (mtd_parts_nb <= 0) { | ||
765 | mtd_parts = pdata->parts; | ||
766 | mtd_parts_nb = pdata->nr_parts; | ||
767 | } | ||
768 | 762 | ||
769 | /* Register any partitions */ | 763 | if (mtd_parts_nb <= 0) { |
770 | if (mtd_parts_nb > 0) { | 764 | mtd_parts = pdata->parts; |
771 | ret = add_mtd_partitions(&info->mtd, | 765 | mtd_parts_nb = pdata->nr_parts; |
772 | mtd_parts, mtd_parts_nb); | 766 | } |
773 | if (ret == 0) | ||
774 | info->partitioned = true; | ||
775 | } | ||
776 | 767 | ||
777 | } else if (pdata->nr_parts) { | 768 | /* Register any partitions */ |
778 | dev_warn(&pdev->dev, "ignoring %d default partitions on %s\n", | 769 | if (mtd_parts_nb > 0) { |
779 | pdata->nr_parts, info->mtd.name); | 770 | ret = mtd_device_register(&info->mtd, mtd_parts, |
771 | mtd_parts_nb); | ||
772 | if (ret == 0) | ||
773 | info->partitioned = true; | ||
780 | } | 774 | } |
781 | 775 | ||
782 | /* If there's no partition info, just package the whole chip | 776 | /* If there's no partition info, just package the whole chip |
783 | * as a single MTD device. | 777 | * as a single MTD device. |
784 | */ | 778 | */ |
785 | if (!info->partitioned) | 779 | if (!info->partitioned) |
786 | ret = add_mtd_device(&info->mtd) ? -ENODEV : 0; | 780 | ret = mtd_device_register(&info->mtd, NULL, 0) ? -ENODEV : 0; |
787 | 781 | ||
788 | if (ret < 0) | 782 | if (ret < 0) |
789 | goto err_scan; | 783 | goto err_scan; |
@@ -824,10 +818,7 @@ static int __exit nand_davinci_remove(struct platform_device *pdev) | |||
824 | struct davinci_nand_info *info = platform_get_drvdata(pdev); | 818 | struct davinci_nand_info *info = platform_get_drvdata(pdev); |
825 | int status; | 819 | int status; |
826 | 820 | ||
827 | if (mtd_has_partitions() && info->partitioned) | 821 | status = mtd_device_unregister(&info->mtd); |
828 | status = del_mtd_partitions(&info->mtd); | ||
829 | else | ||
830 | status = del_mtd_device(&info->mtd); | ||
831 | 822 | ||
832 | spin_lock_irq(&davinci_nand_lock); | 823 | spin_lock_irq(&davinci_nand_lock); |
833 | if (info->chip.ecc.mode == NAND_ECC_HW_SYNDROME) | 824 | if (info->chip.ecc.mode == NAND_ECC_HW_SYNDROME) |