[PATCH] mtd: m25p80: Get mtd_info->name from spi_device as the second choice
Haikun Wang
haikun.wang at freescale.com
Fri Jul 10 01:10:08 PDT 2015
If we can't get "mtd_info->name" form struct flash_platform_data,
get it from "spi_device".
Signed-off-by: Haikun Wang <haikun.wang at freescale.com>
---
drivers/mtd/devices/m25p80.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index d313f948b..ebac9e5 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -215,6 +215,8 @@ static int m25p_probe(struct spi_device *spi)
if (data && data->name)
flash->mtd.name = data->name;
+ else
+ flash->mtd.name = dev_name(&spi->dev);
/* For some (historical?) reason many platforms provide two different
* names in flash_platform_data: "name" and "type". Quite often name is
--
2.1.0.27.g96db324
More information about the linux-mtd
mailing list