kernel: bump 4.19 to 4.19.86
[oweals/openwrt.git] / target / linux / lantiq / patches-4.19 / 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 @@ -19,6 +19,7 @@
18  #include <linux/errno.h>
19  #include <linux/module.h>
20  #include <linux/device.h>
21 +#include <linux/of.h>
22  
23  #include <linux/mtd/mtd.h>
24  #include <linux/mtd/partitions.h>
25 @@ -173,6 +174,10 @@ static int m25p_probe(struct spi_mem *sp
26         };
27         char *flash_name;
28         int ret;
29 +       const char __maybe_unused       *of_mtd_name = NULL;
30 +
31 +       of_property_read_string(spi->dev.of_node,
32 +               "linux,mtd-name", &of_mtd_name);
33  
34         data = dev_get_platdata(&spimem->spi->dev);
35  
36 @@ -211,6 +216,8 @@ static int m25p_probe(struct spi_mem *sp
37  
38         if (data && data->name)
39                 nor->mtd.name = data->name;
40 +       else if (of_mtd_name)
41 +               nor->mtd.name = of_mtd_name;
42  
43         if (!nor->mtd.name)
44                 nor->mtd.name = spi_mem_get_name(spimem);