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>
This commit is contained in:
parent
5f4ba9f925
commit
ea6a472986
|
@ -827,6 +827,7 @@ static int __devinit m25p_probe(struct spi_device *spi)
|
||||||
unsigned i;
|
unsigned i;
|
||||||
struct mtd_partition *parts = NULL;
|
struct mtd_partition *parts = NULL;
|
||||||
int nr_parts = 0;
|
int nr_parts = 0;
|
||||||
|
struct mtd_part_parser_data ppdata;
|
||||||
|
|
||||||
/* Platform data helps sort out which chip type we have, as
|
/* Platform data helps sort out which chip type we have, as
|
||||||
* well as how this board partitions it. If we don't have
|
* 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)
|
||||||
if (info->flags & M25P_NO_ERASE)
|
if (info->flags & M25P_NO_ERASE)
|
||||||
flash->mtd.flags |= MTD_NO_ERASE;
|
flash->mtd.flags |= MTD_NO_ERASE;
|
||||||
|
|
||||||
|
ppdata.of_node = spi->dev.of_node;
|
||||||
flash->mtd.dev.parent = &spi->dev;
|
flash->mtd.dev.parent = &spi->dev;
|
||||||
flash->page_size = info->page_size;
|
flash->page_size = info->page_size;
|
||||||
|
|
||||||
|
@ -968,20 +970,13 @@ static int __devinit m25p_probe(struct spi_device *spi)
|
||||||
/* partitions should match sector boundaries; and it may be good to
|
/* partitions should match sector boundaries; and it may be good to
|
||||||
* use readonly partitions for writeprotected sectors (BP2..BP0).
|
* use readonly partitions for writeprotected sectors (BP2..BP0).
|
||||||
*/
|
*/
|
||||||
nr_parts = parse_mtd_partitions(&flash->mtd, NULL, &parts, 0);
|
nr_parts = parse_mtd_partitions(&flash->mtd, NULL, &parts, &ppdata);
|
||||||
|
|
||||||
if (nr_parts <= 0 && data && data->parts) {
|
if (nr_parts <= 0 && data && data->parts) {
|
||||||
parts = data->parts;
|
parts = data->parts;
|
||||||
nr_parts = data->nr_parts;
|
nr_parts = data->nr_parts;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_MTD_OF_PARTS
|
|
||||||
if (nr_parts <= 0 && spi->dev.of_node) {
|
|
||||||
nr_parts = of_mtd_parse_partitions(&spi->dev,
|
|
||||||
spi->dev.of_node, &parts);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (nr_parts > 0) {
|
if (nr_parts > 0) {
|
||||||
for (i = 0; i < nr_parts; i++) {
|
for (i = 0; i < nr_parts; i++) {
|
||||||
DEBUG(MTD_DEBUG_LEVEL2, "partitions[%d] = "
|
DEBUG(MTD_DEBUG_LEVEL2, "partitions[%d] = "
|
||||||
|
|
Loading…
Reference in a new issue