mac80211: backport more brcmfmac changes queued for the 5.1
[openwrt/staging/jogo.git] / package / kernel / mac80211 / patches / brcm / 351-v5.1-0001-brcmfmac-improve-code-handling-bandwidth-of-firmware.patch
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
10 1) Use switch to simplify/improve the code & avoid some duplication
11 2) Add warning for unsupported values
12
13 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
14 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
15 ---
16 .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 13 ++++++++++---
17 1 file changed, 10 insertions(+), 3 deletions(-)
18
19 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
20 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
21 @@ -6043,11 +6043,18 @@ static int brcmf_construct_chaninfo(stru
22 /* assuming the chanspecs order is HT20,
23 * HT40 upper, HT40 lower, and VHT80.
24 */
25 - if (ch.bw == BRCMU_CHAN_BW_80) {
26 + switch (ch.bw) {
27 + case BRCMU_CHAN_BW_80:
28 channel->flags &= ~IEEE80211_CHAN_NO_80MHZ;
29 - } else if (ch.bw == BRCMU_CHAN_BW_40) {
30 + break;
31 + case BRCMU_CHAN_BW_40:
32 brcmf_update_bw40_channel_flag(channel, &ch);
33 - } else {
34 + break;
35 + default:
36 + wiphy_warn(wiphy, "Firmware reported unsupported bandwidth %d\n",
37 + ch.bw);
38 + /* fall through */
39 + case BRCMU_CHAN_BW_20:
40 /* enable the channel and disable other bandwidths
41 * for now as mentioned order assure they are enabled
42 * for subsequent chanspecs.