Wen Gong <quic_wgong@xxxxxxxxxxx> writes: > The transmit power envelope element has some fields for power, ath11k > should parse it according to IEEE Std 802.11ax™‐2021. > > Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1 > > Signed-off-by: Wen Gong <quic_wgong@xxxxxxxxxxx> [...] > +static u8 ath11k_mac_get_num_pwr_levels(struct cfg80211_chan_def *chan_def) > +{ > + u8 num_pwr_levels; > + > + if (chan_def->chan->flags & IEEE80211_CHAN_PSD) { > + switch (chan_def->width) { > + case NL80211_CHAN_WIDTH_20: > + num_pwr_levels = 1; > + break; > + case NL80211_CHAN_WIDTH_40: > + num_pwr_levels = 2; > + break; > + case NL80211_CHAN_WIDTH_80: > + num_pwr_levels = 4; > + break; > + case NL80211_CHAN_WIDTH_80P80: > + case NL80211_CHAN_WIDTH_160: > + num_pwr_levels = 8; > + break; > + default: > + return 1; > + } > + } else { > + switch (chan_def->width) { > + case NL80211_CHAN_WIDTH_20: > + num_pwr_levels = 1; > + break; > + case NL80211_CHAN_WIDTH_40: > + num_pwr_levels = 2; > + break; > + case NL80211_CHAN_WIDTH_80: > + num_pwr_levels = 3; > + break; > + case NL80211_CHAN_WIDTH_80P80: > + case NL80211_CHAN_WIDTH_160: > + num_pwr_levels = 4; > + break; > + default: > + return 1; > + } > + } > + > + return num_pwr_levels; > +} num_pwr_levels variable is not really creating any extra value, it's clearner to directly use 'return' on every case. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches