339-v5.1-0006-brcmfmac-improve-code-handling-bandwidth-of-firmware.patch 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. From f4e183293b871c96c0220dcc549d5ca4c72628ad Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
  3. Date: Mon, 11 Feb 2019 23:04:53 +0100
  4. Subject: [PATCH] brcmfmac: improve code handling bandwidth of firmware
  5. reported channels
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. 1) Use switch to simplify/improve the code & avoid some duplication
  10. 2) Add warning for unsupported values
  11. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  12. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13. ---
  14. .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 13 ++++++++++---
  15. 1 file changed, 10 insertions(+), 3 deletions(-)
  16. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18. @@ -6003,11 +6003,18 @@ static int brcmf_construct_chaninfo(stru
  19. /* assuming the chanspecs order is HT20,
  20. * HT40 upper, HT40 lower, and VHT80.
  21. */
  22. - if (ch.bw == BRCMU_CHAN_BW_80) {
  23. + switch (ch.bw) {
  24. + case BRCMU_CHAN_BW_80:
  25. channel->flags &= ~IEEE80211_CHAN_NO_80MHZ;
  26. - } else if (ch.bw == BRCMU_CHAN_BW_40) {
  27. + break;
  28. + case BRCMU_CHAN_BW_40:
  29. brcmf_update_bw40_channel_flag(channel, &ch);
  30. - } else {
  31. + break;
  32. + default:
  33. + wiphy_warn(wiphy, "Firmware reported unsupported bandwidth %d\n",
  34. + ch.bw);
  35. + /* fall through */
  36. + case BRCMU_CHAN_BW_20:
  37. /* enable the channel and disable other bandwidths
  38. * for now as mentioned order assure they are enabled
  39. * for subsequent chanspecs.