summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/spi-nor
diff options
context:
space:
mode:
authorHuang Shijie <b32955@freescale.com>2014-02-24 11:37:40 +0100
committerBrian Norris <computersforpeace@gmail.com>2014-04-14 20:22:58 +0200
commit0d8c11c01274bde227d368daa8954911dd324a9f (patch)
tree74a5cea5d6cbe628aba708aa2117d344ca6475c1 /drivers/mtd/spi-nor
parentmtd: m25p80: use the SPI nor framework (diff)
downloadlinux-0d8c11c01274bde227d368daa8954911dd324a9f.tar.xz
linux-0d8c11c01274bde227d368daa8954911dd324a9f.zip
mtd: spi-nor: add a helper to find the spi_device_id
Add the spi_nor_match_id() to find the proper spi_device_id with the NOR flash's name in the spi_nor_ids table. Signed-off-by: Huang Shijie <b32955@freescale.com> Acked-by: Marek Vasut <marex@denx.de> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd/spi-nor')
-rw-r--r--drivers/mtd/spi-nor/spi-nor.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 50b929095bdb..f7c9e638623b 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -1082,6 +1082,18 @@ int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id,
return 0;
}
+const struct spi_device_id *spi_nor_match_id(char *name)
+{
+ const struct spi_device_id *id = spi_nor_ids;
+
+ while (id->name[0]) {
+ if (!strcmp(name, id->name))
+ return id;
+ id++;
+ }
+ return NULL;
+}
+
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Huang Shijie <shijie8@gmail.com>");
MODULE_AUTHOR("Mike Lavender");