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