Skip to contentSkip to conversation

mtd: fix build error in m25p80.c

PATCH Andres Salomon 2 participants 2 messages Oct 30, 2010 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

While building an x86 distro kernel, I hit the following:

Kernel: arch/x86/boot/bzImage is ready (#7)
ERROR: "of_mtd_parse_partitions" [drivers/mtd/devices/m25p80.ko] undefined!

of_mtd_parse_partitions is defined with MTD_OF_PARTS, and that's only built on PPC and microblaze. The code in question should be wrapped w/ a stricter #ifdef.

---
 drivers/mtd/devices/m25p80.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mtd/devices/m25p80.c +1 -1
index ea22520..184ddd5 100644
@@ -924,7 +924,7 @@ static int __devinit m25p_probe(struct spi_device *spi)
 			nr_parts = data->nr_parts;
 		}
 
-#ifdef CONFIG_OF
+#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);
Signature · 1 line
1.7.1
#1 lore raw
Quoted 21 lines · Andres Salomon

While building an x86 distro kernel, I hit the following:

Kernel: arch/x86/boot/bzImage is ready (#7)
ERROR: "of_mtd_parse_partitions" [drivers/mtd/devices/m25p80.ko] undefined!

of_mtd_parse_partitions is defined with MTD_OF_PARTS, and that's only built on PPC and microblaze. The code in question should be wrapped w/ a stricter #ifdef.

---
 drivers/mtd/devices/m25p80.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mtd/devices/m25p80.c +0 -0
index ea22520..184ddd5 100644

drivers/mtd/devices/m25p80.c static int __devinit m25p_probe(struct spi_device *spi) · line 930

Quoted 8 lines
drivers/mtd/devices/m25p80.c +1 -1
@@ -924,7 +924,7 @@ static int __devinit m25p_probe(struct spi_device *spi)
 			nr_parts = data->nr_parts;
 		}
 
-#ifdef CONFIG_OF
+#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);

True; but CONFIG_MTD_OF_PARTS should be built on all architectures when CONFIG_OF & CONFIG_MTD_PARTITIONS is set. I'll craft a patch.

g.