kernel: refresh patches
[openwrt/openwrt.git] / target / linux / lantiq / patches-3.14 / 0022-MTD-m25p80-allow-loading-mtd-name-from-OF.patch
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
5
6 In accordance with the physmap flash we should honour the linux,mtd-name
7 property when deciding what name the mtd device has.
8
9 Signed-off-by: Thomas Langer <thomas.langer@lantiq.com>
10 Signed-off-by: John Crispin <blogic@openwrt.org>
11 ---
12 drivers/mtd/devices/m25p80.c | 6 ++++++
13 1 file changed, 6 insertions(+)
14
15 --- a/drivers/mtd/devices/m25p80.c
16 +++ b/drivers/mtd/devices/m25p80.c
17 @@ -1105,6 +1105,10 @@ static int m25p_probe(struct spi_device
18 struct mtd_part_parser_data ppdata;
19 struct device_node *np = spi->dev.of_node;
20 int ret;
21 + const char __maybe_unused *of_mtd_name = NULL;
22 +
23 + of_property_read_string(spi->dev.of_node,
24 + "linux,mtd-name", &of_mtd_name);
25
26 /* Platform data helps sort out which chip type we have, as
27 * well as how this board partitions it. If we don't have
28 @@ -1177,6 +1181,8 @@ static int m25p_probe(struct spi_device
29
30 if (data && data->name)
31 flash->mtd.name = data->name;
32 + else if (of_mtd_name)
33 + flash->mtd.name = of_mtd_name;
34 else
35 flash->mtd.name = dev_name(&spi->dev);
36