[PATCH] physmap: do not probe absent modules

Atsushi Nemoto anemo at mba.ocn.ne.jp
Thu Apr 24 09:38:30 EDT 2008


For example, if MTD_CFI was not enabled, probing it does nothing other
than just produces an error message.

Signed-off-by: Atsushi Nemoto <anemo at mba.ocn.ne.jp>
---
 drivers/mtd/maps/physmap.c |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c
index bc4649a..7f8f3bd 100644
--- a/drivers/mtd/maps/physmap.c
+++ b/drivers/mtd/maps/physmap.c
@@ -85,9 +85,29 @@ static int physmap_flash_remove(struct platform_device *dev)
 	return 0;
 }
 
-static const char *rom_probe_types[] = { "cfi_probe", "jedec_probe", "map_rom", NULL };
+static const char *rom_probe_types[] = {
+#if defined(CONFIG_MTD_CFI) || defined(CONFIG_MTD_CFI_MODULE)
+	"cfi_probe",
+#endif
+#if defined(CONFIG_MTD_JEDECPROBE) || defined(CONFIG_MTD_JEDECPROBE_MODULE)
+	"jedec_probe",
+#endif
+#if defined(CONFIG_MTD_ROM) || defined(CONFIG_MTD_ROM_MODULE)
+	"map_rom",
+#endif
+	NULL
+};
 #ifdef CONFIG_MTD_PARTITIONS
-static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", NULL };
+static const char *part_probe_types[] = {
+#if defined(CONFIG_MTD_CMDLINE_PARTS)
+	"cmdlinepart",
+#endif
+#if defined(CONFIG_MTD_REDBOOT_PARTS) || \
+	defined(CONFIG_MTD_REDBOOT_PARTS_MODULE)
+	"RedBoot",
+#endif
+	NULL
+};
 #endif
 
 static int physmap_flash_probe(struct platform_device *dev)



More information about the linux-mtd mailing list