kernel: bump 4.14 to 4.14.91
[openwrt/staging/chunkeey.git] / target / linux / pistachio / patches-4.14 / 401-mtd-nor-support-mtd-name-from-device-tree.patch
1 From f32bc2aa01edcba2f2ed5db151cf183eac9ef919 Mon Sep 17 00:00:00 2001
2 From: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
3 Date: Sat, 25 Feb 2017 16:42:50 +0000
4 Subject: mtd: nor: support mtd name from device tree
5
6 Signed-off-by: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
7 ---
8 drivers/mtd/spi-nor/spi-nor.c | 8 +++++++-
9 1 file changed, 7 insertions(+), 1 deletion(-)
10
11 --- a/drivers/mtd/spi-nor/spi-nor.c
12 +++ b/drivers/mtd/spi-nor/spi-nor.c
13 @@ -2663,6 +2663,7 @@ int spi_nor_scan(struct spi_nor *nor, co
14 struct device *dev = nor->dev;
15 struct mtd_info *mtd = &nor->mtd;
16 struct device_node *np = spi_nor_get_flash_node(nor);
17 + const char __maybe_unused *of_mtd_name = NULL;
18 int ret;
19 int i;
20
21 @@ -2738,7 +2739,12 @@ int spi_nor_scan(struct spi_nor *nor, co
22 spi_nor_wait_till_ready(nor);
23 }
24
25 - if (!mtd->name)
26 +#ifdef CONFIG_MTD_OF_PARTS
27 + of_property_read_string(np, "linux,mtd-name", &of_mtd_name);
28 +#endif
29 + if (of_mtd_name)
30 + mtd->name = of_mtd_name;
31 + else if (!mtd->name)
32 mtd->name = dev_name(dev);
33 mtd->priv = nor;
34 mtd->type = MTD_NORFLASH;