diff options
author | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2011-05-29 17:02:20 -0400 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@intel.com> | 2011-09-11 08:02:11 -0400 |
commit | ea6a4729869f899a904d862168bfc31e1451570e (patch) | |
tree | 4cf3a3e9169e908bf64d99a4779f987d045fe5c5 /drivers/mtd/devices/m25p80.c | |
parent | 5f4ba9f9251a76753f50a4b9b8f49e6ec83d3d22 (diff) |
mtd: m25p80: use ofpart through generic parsing
Convert the driver to use ofpart partitions parsing through the generic
parse_mtd_partitions().
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
Diffstat (limited to 'drivers/mtd/devices/m25p80.c')
-rw-r--r-- | drivers/mtd/devices/m25p80.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index 70d5fcacc3fd..399c2349265f 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c | |||
@@ -827,6 +827,7 @@ static int __devinit m25p_probe(struct spi_device *spi) | |||
827 | unsigned i; | 827 | unsigned i; |
828 | struct mtd_partition *parts = NULL; | 828 | struct mtd_partition *parts = NULL; |
829 | int nr_parts = 0; | 829 | int nr_parts = 0; |
830 | struct mtd_part_parser_data ppdata; | ||
830 | 831 | ||
831 | /* Platform data helps sort out which chip type we have, as | 832 | /* Platform data helps sort out which chip type we have, as |
832 | * well as how this board partitions it. If we don't have | 833 | * well as how this board partitions it. If we don't have |
@@ -928,6 +929,7 @@ static int __devinit m25p_probe(struct spi_device *spi) | |||
928 | if (info->flags & M25P_NO_ERASE) | 929 | if (info->flags & M25P_NO_ERASE) |
929 | flash->mtd.flags |= MTD_NO_ERASE; | 930 | flash->mtd.flags |= MTD_NO_ERASE; |
930 | 931 | ||
932 | ppdata.of_node = spi->dev.of_node; | ||
931 | flash->mtd.dev.parent = &spi->dev; | 933 | flash->mtd.dev.parent = &spi->dev; |
932 | flash->page_size = info->page_size; | 934 | flash->page_size = info->page_size; |
933 | 935 | ||
@@ -968,20 +970,13 @@ static int __devinit m25p_probe(struct spi_device *spi) | |||
968 | /* partitions should match sector boundaries; and it may be good to | 970 | /* partitions should match sector boundaries; and it may be good to |
969 | * use readonly partitions for writeprotected sectors (BP2..BP0). | 971 | * use readonly partitions for writeprotected sectors (BP2..BP0). |
970 | */ | 972 | */ |
971 | nr_parts = parse_mtd_partitions(&flash->mtd, NULL, &parts, 0); | 973 | nr_parts = parse_mtd_partitions(&flash->mtd, NULL, &parts, &ppdata); |
972 | 974 | ||
973 | if (nr_parts <= 0 && data && data->parts) { | 975 | if (nr_parts <= 0 && data && data->parts) { |
974 | parts = data->parts; | 976 | parts = data->parts; |
975 | nr_parts = data->nr_parts; | 977 | nr_parts = data->nr_parts; |
976 | } | 978 | } |
977 | 979 | ||
978 | #ifdef CONFIG_MTD_OF_PARTS | ||
979 | if (nr_parts <= 0 && spi->dev.of_node) { | ||
980 | nr_parts = of_mtd_parse_partitions(&spi->dev, | ||
981 | spi->dev.of_node, &parts); | ||
982 | } | ||
983 | #endif | ||
984 | |||
985 | if (nr_parts > 0) { | 980 | if (nr_parts > 0) { |
986 | for (i = 0; i < nr_parts; i++) { | 981 | for (i = 0; i < nr_parts; i++) { |
987 | DEBUG(MTD_DEBUG_LEVEL2, "partitions[%d] = " | 982 | DEBUG(MTD_DEBUG_LEVEL2, "partitions[%d] = " |