596cc6fcb7c56a330b957589e6c323dec9db2b2d
[openwrt/staging/dedeckeh.git] / target / linux / layerscape / patches-4.4 / 1075-mtd-spi-nor-convert-to-spi_nor_-get-set-_flash_node.patch
1 From f906ec330da9aa83de5382653436be36273c63d3 Mon Sep 17 00:00:00 2001
2 From: Brian Norris <computersforpeace@gmail.com>
3 Date: Fri, 30 Oct 2015 20:33:24 -0700
4 Subject: [PATCH 075/113] mtd: spi-nor: convert to spi_nor_{get,
5 set}_flash_node()
6
7 Used semantic patch with 'make coccicheck MODE=patch COCCI=script.cocci':
8
9 ---8<----
10 virtual patch
11
12 @@
13 struct spi_nor b;
14 struct spi_nor *c;
15 expression d;
16 @@
17 (
18 -(b).flash_node = (d)
19 +spi_nor_set_flash_node(&b, d)
20 |
21 -(c)->flash_node = (d)
22 +spi_nor_set_flash_node(c, d)
23 )
24 ---8<----
25
26 And a manual conversion for the one use of spi_nor_get_flash_node().
27
28 Signed-off-by: Brian Norris <computersforpeace@gmail.com>
29 Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
30 ---
31 drivers/mtd/devices/m25p80.c | 2 +-
32 drivers/mtd/spi-nor/fsl-quadspi.c | 2 +-
33 drivers/mtd/spi-nor/nxp-spifi.c | 2 +-
34 drivers/mtd/spi-nor/spi-nor.c | 2 +-
35 4 files changed, 4 insertions(+), 4 deletions(-)
36
37 --- a/drivers/mtd/devices/m25p80.c
38 +++ b/drivers/mtd/devices/m25p80.c
39 @@ -221,7 +221,7 @@ static int m25p_probe(struct spi_device
40 nor->read_reg = m25p80_read_reg;
41
42 nor->dev = &spi->dev;
43 - nor->flash_node = spi->dev.of_node;
44 + spi_nor_set_flash_node(nor, spi->dev.of_node);
45 nor->priv = flash;
46
47 spi_set_drvdata(spi, flash);
48 --- a/drivers/mtd/spi-nor/fsl-quadspi.c
49 +++ b/drivers/mtd/spi-nor/fsl-quadspi.c
50 @@ -1013,7 +1013,7 @@ static int fsl_qspi_probe(struct platfor
51 mtd = &nor->mtd;
52
53 nor->dev = dev;
54 - nor->flash_node = np;
55 + spi_nor_set_flash_node(nor, np);
56 nor->priv = q;
57
58 /* fill the hooks */
59 --- a/drivers/mtd/spi-nor/nxp-spifi.c
60 +++ b/drivers/mtd/spi-nor/nxp-spifi.c
61 @@ -330,7 +330,7 @@ static int nxp_spifi_setup_flash(struct
62 writel(ctrl, spifi->io_base + SPIFI_CTRL);
63
64 spifi->nor.dev = spifi->dev;
65 - spifi->nor.flash_node = np;
66 + spi_nor_set_flash_node(&spifi->nor, np);
67 spifi->nor.priv = spifi;
68 spifi->nor.read = nxp_spifi_read;
69 spifi->nor.write = nxp_spifi_write;
70 --- a/drivers/mtd/spi-nor/spi-nor.c
71 +++ b/drivers/mtd/spi-nor/spi-nor.c
72 @@ -1113,7 +1113,7 @@ int spi_nor_scan(struct spi_nor *nor, co
73 const struct flash_info *info = NULL;
74 struct device *dev = nor->dev;
75 struct mtd_info *mtd = &nor->mtd;
76 - struct device_node *np = nor->flash_node;
77 + struct device_node *np = spi_nor_get_flash_node(nor);
78 int ret;
79 int i;
80