314-v4.16-0006-brcmfmac-More-efficient-and-slightly-easier-to-read-.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. From bcadaaa097c7ec103fe75f9da41f8fe52693b644 Mon Sep 17 00:00:00 2001
  2. From: Arend Van Spriel <[email protected]>
  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. Its more efficient to test the register we're interested in first,
  7. potentially avoiding two more comparisons, and therefore always avoiding
  8. one comparison per call on all other chips.
  9. Signed-off-by: Ian Molton <[email protected]>
  10. [arend: fix some checkpatch warnings]
  11. Signed-off-by: Arend van Spriel <[email protected]>
  12. Signed-off-by: Kalle Valo <[email protected]>
  13. ---
  14. drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 7 ++++---
  15. 1 file changed, 4 insertions(+), 3 deletions(-)
  16. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  17. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  18. @@ -3772,15 +3772,16 @@ static u32 brcmf_sdio_buscore_read32(voi
  19. val = brcmf_sdiod_readl(sdiodev, addr, NULL);
  20. - if ((sdiodev->func[1]->device == SDIO_DEVICE_ID_BROADCOM_4335_4339 ||
  21. - sdiodev->func[1]->device == SDIO_DEVICE_ID_BROADCOM_4339) &&
  22. - addr == CORE_CC_REG(SI_ENUM_BASE, chipid)) {
  23. + if (addr == CORE_CC_REG(SI_ENUM_BASE, chipid) &&
  24. + (sdiodev->func[1]->device == SDIO_DEVICE_ID_BROADCOM_4339 ||
  25. + sdiodev->func[1]->device == SDIO_DEVICE_ID_BROADCOM_4335_4339)) {
  26. rev = (val & CID_REV_MASK) >> CID_REV_SHIFT;
  27. if (rev >= 2) {
  28. val &= ~CID_ID_MASK;
  29. val |= BRCM_CC_4339_CHIP_ID;
  30. }
  31. }
  32. +
  33. return val;
  34. }