1 From 4400e1f593ea40a51912128adb4f53d59e62cad8 Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Wed, 10 Sep 2014 22:40:18 +0200
4 Subject: [PATCH 22/36] MTD: m25p80: allow loading mtd name from OF
6 In accordance with the physmap flash we should honour the linux,mtd-name
7 property when deciding what name the mtd device has.
9 Signed-off-by: Thomas Langer <thomas.langer@lantiq.com>
10 Signed-off-by: John Crispin <blogic@openwrt.org>
12 drivers/mtd/devices/m25p80.c | 6 ++++++
13 1 file changed, 6 insertions(+)
15 --- a/drivers/mtd/devices/m25p80.c
16 +++ b/drivers/mtd/devices/m25p80.c
17 @@ -198,6 +198,10 @@ static int m25p_probe(struct spi_device
18 enum read_mode mode = SPI_NOR_NORMAL;
19 char *flash_name = NULL;
21 + const char __maybe_unused *of_mtd_name = NULL;
23 + of_property_read_string(spi->dev.of_node,
24 + "linux,mtd-name", &of_mtd_name);
26 data = dev_get_platdata(&spi->dev);
28 @@ -229,6 +233,8 @@ static int m25p_probe(struct spi_device
30 if (data && data->name)
31 flash->mtd.name = data->name;
32 + else if (of_mtd_name)
33 + flash->mtd.name = of_mtd_name;
35 /* For some (historical?) reason many platforms provide two different
36 * names in flash_platform_data: "name" and "type". Quite often name is