39fba211fec3818db3a569b81e417a908963430d
[openwrt/staging/mans0n.git] /
1 From 2d6edad4b2da1991f74e7b02053eeb4a043b887f Mon Sep 17 00:00:00 2001
2 From: Arend Van Spriel <arend.vanspriel@broadcom.com>
3 Date: Tue, 20 Feb 2018 00:14:25 +0100
4 Subject: [PATCH] brcmfmac: remove duplicate pointer variable from
5 brcmf_sdio_firmware_callback()
6
7 In brcmf_sdio_firmware_callback() two pointer variables were used
8 pointing to the same construct. Get rid of sdiodev variable.
9
10 Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
11 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
12 ---
13 .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 37 +++++++++++-----------
14 1 file changed, 18 insertions(+), 19 deletions(-)
15
16 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
17 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
18 @@ -4039,9 +4039,8 @@ static void brcmf_sdio_firmware_callback
19 void *nvram, u32 nvram_len)
20 {
21 struct brcmf_bus *bus_if = dev_get_drvdata(dev);
22 - struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
23 - struct brcmf_sdio *bus = sdiodev->bus;
24 - struct brcmf_sdio_dev *sdiod = bus->sdiodev;
25 + struct brcmf_sdio_dev *sdiod = bus_if->bus_priv.sdio;
26 + struct brcmf_sdio *bus = sdiod->bus;
27 struct brcmf_core *core = bus->sdio_core;
28 u8 saveclk;
29
30 @@ -4061,7 +4060,7 @@ static void brcmf_sdio_firmware_callback
31 bus->sdcnt.tickcnt = 0;
32 brcmf_sdio_wd_timer(bus, true);
33
34 - sdio_claim_host(sdiodev->func1);
35 + sdio_claim_host(sdiod->func1);
36
37 /* Make sure backplane clock is on, needed to generate F2 interrupt */
38 brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
39 @@ -4069,9 +4068,9 @@ static void brcmf_sdio_firmware_callback
40 goto release;
41
42 /* Force clocks on backplane to be sure F2 interrupt propagates */
43 - saveclk = brcmf_sdiod_readb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, &err);
44 + saveclk = brcmf_sdiod_readb(sdiod, SBSDIO_FUNC1_CHIPCLKCSR, &err);
45 if (!err) {
46 - brcmf_sdiod_writeb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
47 + brcmf_sdiod_writeb(sdiod, SBSDIO_FUNC1_CHIPCLKCSR,
48 (saveclk | SBSDIO_FORCE_HT), &err);
49 }
50 if (err) {
51 @@ -4083,7 +4082,7 @@ static void brcmf_sdio_firmware_callback
52 brcmf_sdiod_writel(sdiod, core->base + SD_REG(tosbmailboxdata),
53 SDPCM_PROT_VERSION << SMB_DATA_VERSION_SHIFT, NULL);
54
55 - err = sdio_enable_func(sdiodev->func2);
56 + err = sdio_enable_func(sdiod->func2);
57
58 brcmf_dbg(INFO, "enable F2: err=%d\n", err);
59
60 @@ -4095,10 +4094,10 @@ static void brcmf_sdio_firmware_callback
61 bus->hostintmask, NULL);
62
63
64 - brcmf_sdiod_writeb(sdiodev, SBSDIO_WATERMARK, 8, &err);
65 + brcmf_sdiod_writeb(sdiod, SBSDIO_WATERMARK, 8, &err);
66 } else {
67 /* Disable F2 again */
68 - sdio_disable_func(sdiodev->func2);
69 + sdio_disable_func(sdiod->func2);
70 goto release;
71 }
72
73 @@ -4106,7 +4105,7 @@ static void brcmf_sdio_firmware_callback
74 brcmf_sdio_sr_init(bus);
75 } else {
76 /* Restore previous clock setting */
77 - brcmf_sdiod_writeb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
78 + brcmf_sdiod_writeb(sdiod, SBSDIO_FUNC1_CHIPCLKCSR,
79 saveclk, &err);
80 }
81
82 @@ -4114,7 +4113,7 @@ static void brcmf_sdio_firmware_callback
83 /* Allow full data communication using DPC from now on. */
84 brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DATA);
85
86 - err = brcmf_sdiod_intr_register(sdiodev);
87 + err = brcmf_sdiod_intr_register(sdiod);
88 if (err != 0)
89 brcmf_err("intr register failed:%d\n", err);
90 }
91 @@ -4123,16 +4122,16 @@ static void brcmf_sdio_firmware_callback
92 if (err != 0)
93 brcmf_sdio_clkctl(bus, CLK_NONE, false);
94
95 - sdio_release_host(sdiodev->func1);
96 + sdio_release_host(sdiod->func1);
97
98 /* Assign bus interface call back */
99 - sdiodev->bus_if->dev = sdiodev->dev;
100 - sdiodev->bus_if->ops = &brcmf_sdio_bus_ops;
101 - sdiodev->bus_if->chip = bus->ci->chip;
102 - sdiodev->bus_if->chiprev = bus->ci->chiprev;
103 + sdiod->bus_if->dev = sdiod->dev;
104 + sdiod->bus_if->ops = &brcmf_sdio_bus_ops;
105 + sdiod->bus_if->chip = bus->ci->chip;
106 + sdiod->bus_if->chiprev = bus->ci->chiprev;
107
108 /* Attach to the common layer, reserve hdr space */
109 - err = brcmf_attach(sdiodev->dev, sdiodev->settings);
110 + err = brcmf_attach(sdiod->dev, sdiod->settings);
111 if (err != 0) {
112 brcmf_err("brcmf_attach failed\n");
113 goto fail;
114 @@ -4142,10 +4141,10 @@ static void brcmf_sdio_firmware_callback
115 return;
116
117 release:
118 - sdio_release_host(sdiodev->func1);
119 + sdio_release_host(sdiod->func1);
120 fail:
121 brcmf_dbg(TRACE, "failed: dev=%s, err=%d\n", dev_name(dev), err);
122 - device_release_driver(&sdiodev->func2->dev);
123 + device_release_driver(&sdiod->func2->dev);
124 device_release_driver(dev);
125 }
126