diff mbox series

[1/2] brcmfmac: improve code handling bandwidth of firmware reported channels

Message ID 20190211220454.19850-1-zajec5@gmail.com (mailing list archive)
State Accepted
Commit f4e183293b871c96c0220dcc549d5ca4c72628ad
Delegated to: Kalle Valo
Headers show
Series [1/2] brcmfmac: improve code handling bandwidth of firmware reported channels | expand

Commit Message

Rafał Miłecki Feb. 11, 2019, 10:04 p.m. UTC
From: Rafał Miłecki <rafal@milecki.pl>

1) Use switch to simplify/improve the code & avoid some duplication
2) Add warning for unsupported values

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

Comments

Kalle Valo Feb. 19, 2019, 3:06 p.m. UTC | #1
Rafał Miłecki wrote:

> From: Rafał Miłecki <rafal@milecki.pl>
> 
> 1) Use switch to simplify/improve the code & avoid some duplication
> 2) Add warning for unsupported values
> 
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>

2 patches applied to wireless-drivers-next.git, thanks.

f4e183293b87 brcmfmac: improve code handling bandwidth of firmware reported channels
30519cbe339a brcmfmac: support firmware reporting 160 MHz channels
diff mbox series

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index b5e291ed9496..fa752ec04f22 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -6049,11 +6049,18 @@  static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg,
 		/* assuming the chanspecs order is HT20,
 		 * HT40 upper, HT40 lower, and VHT80.
 		 */
-		if (ch.bw == BRCMU_CHAN_BW_80) {
+		switch (ch.bw) {
+		case BRCMU_CHAN_BW_80:
 			channel->flags &= ~IEEE80211_CHAN_NO_80MHZ;
-		} else if (ch.bw == BRCMU_CHAN_BW_40) {
+			break;
+		case BRCMU_CHAN_BW_40:
 			brcmf_update_bw40_channel_flag(channel, &ch);
-		} else {
+			break;
+		default:
+			wiphy_warn(wiphy, "Firmware reported unsupported bandwidth %d\n",
+				   ch.bw);
+			/* fall through */
+		case BRCMU_CHAN_BW_20:
 			/* enable the channel and disable other bandwidths
 			 * for now as mentioned order assure they are enabled
 			 * for subsequent chanspecs.