71e4894b063664631c43b0a2a9bc5ea3d0045fe6
[oweals/openwrt.git] /
1 From bcadaaa097c7ec103fe75f9da41f8fe52693b644 Mon Sep 17 00:00:00 2001
2 From: Arend Van Spriel <arend.vanspriel@broadcom.com>
3 Date: Tue, 19 Dec 2017 13:47:12 +0100
4 Subject: [PATCH] brcmfmac: More efficient and slightly easier to read fixup
5  for 4339 chips
6
7 Its more efficient to test the register we're interested in first,
8 potentially avoiding two more comparisons, and therefore always avoiding
9 one comparison per call on all other chips.
10
11 Signed-off-by: Ian Molton <ian@mnementh.co.uk>
12 [arend: fix some checkpatch warnings]
13 Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
14 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
15 ---
16  drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 7 ++++---
17  1 file changed, 4 insertions(+), 3 deletions(-)
18
19 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
20 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
21 @@ -3772,15 +3772,16 @@ static u32 brcmf_sdio_buscore_read32(voi
22  
23         val = brcmf_sdiod_readl(sdiodev, addr, NULL);
24  
25 -       if ((sdiodev->func[1]->device == SDIO_DEVICE_ID_BROADCOM_4335_4339 ||
26 -            sdiodev->func[1]->device == SDIO_DEVICE_ID_BROADCOM_4339) &&
27 -            addr == CORE_CC_REG(SI_ENUM_BASE, chipid)) {
28 +       if (addr == CORE_CC_REG(SI_ENUM_BASE, chipid) &&
29 +           (sdiodev->func[1]->device == SDIO_DEVICE_ID_BROADCOM_4339 ||
30 +            sdiodev->func[1]->device == SDIO_DEVICE_ID_BROADCOM_4335_4339)) {
31                 rev = (val & CID_REV_MASK) >> CID_REV_SHIFT;
32                 if (rev >= 2) {
33                         val &= ~CID_ID_MASK;
34                         val |= BRCM_CC_4339_CHIP_ID;
35                 }
36         }
37 +
38         return val;
39  }
40