@@ -1081,6 +1081,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("Freescale Semiconductor Inc.");
MODULE_DESCRIPTION("framework for SPI NOR nor");
@@ -162,5 +162,6 @@ struct spi_nor {
int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id,
enum read_mode mode);
extern const struct spi_device_id spi_nor_ids[];
+const struct spi_device_id * spi_nor_match_id(char *name);
#endif
Add the spi_nor_match_id() to find the proper spi_device_id in the spi_nor_ids table. Signed-off-by: Huang Shijie <b32955@freescale.com> --- drivers/mtd/spi-nor/spi-nor.c | 12 ++++++++++++ include/linux/mtd/spi-nor.h | 1 + 2 files changed, 13 insertions(+), 0 deletions(-)