mtd: m25p80: don't probe device which has status of 'disabled'

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Nov 7 11:59:37 EST 2011


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=5f949137952020214cd167093dd7be448f21c079
Commit:     5f949137952020214cd167093dd7be448f21c079
Parent:     57468a646e513bd88aeaa322eee2a8a960df91fc
Author:     Shaohui Xie <Shaohui.Xie at freescale.com>
AuthorDate: Fri Oct 14 15:49:00 2011 +0800
Committer:  Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
CommitDate: Sun Oct 16 14:51:04 2011 +0300

    mtd: m25p80: don't probe device which has status of 'disabled'
    
    On some platforms such as P3060QDS, has multiple spi flashes, but they are
    not available at same time, so if their status is 'disabled', which is set
    by u-boot, will not be probed.
    
    Signed-off-by: Shaohui Xie <Shaohui.Xie at freescale.com>
    Signed-off-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
---
 drivers/mtd/devices/m25p80.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 02aecac..884904d 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -30,6 +30,7 @@
 #include <linux/mtd/cfi.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
+#include <linux/of_platform.h>
 
 #include <linux/spi/spi.h>
 #include <linux/spi/flash.h>
@@ -823,6 +824,11 @@ static int __devinit m25p_probe(struct spi_device *spi)
 	unsigned			i;
 	struct mtd_part_parser_data	ppdata;
 
+#ifdef CONFIG_MTD_OF_PARTS
+	if (!of_device_is_available(spi->dev.of_node))
+		return -ENODEV;
+#endif
+
 	/* Platform data helps sort out which chip type we have, as
 	 * well as how this board partitions it.  If we don't have
 	 * a chip ID, try the JEDEC id commands; they'll work for most



More information about the linux-mtd-cvs mailing list