projects/linux·commit 97ff46cb

mtd/m25p80: add support to parse the partitions by OF node

97ff46cb · Mingkai Hu <[email protected]> · 2010-10-12 18:18:34 +08:00

Signed-off-by: Mingkai Hu <[email protected]>
[[email protected]: wrap hunk with #ifdef CONFIG_OF]
Signed-off-by: Grant Likely <[email protected]>
Commit
97ff46cb69da22037346670ae515217c658ace02
Parents
530719b2

Changes

1 files changed · +7 −0

FileStatusAddDelContent
drivers/mtd/devices/m25p80.cmodified+7−0View file

drivers/mtd/devices/m25p80.c

View file
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 6f512b5..ea22520 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -924,6 +924,13 @@ static int __devinit m25p_probe(struct spi_device *spi)
nr_parts = data->nr_parts;
}
+#ifdef CONFIG_OF
+ 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) {
for (i = 0; i < nr_parts; i++) {
DEBUG(MTD_DEBUG_LEVEL2, "partitions[%d] = "