Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

wifi: mac80211: don't use cfg80211_chandef_create() for default chandef

cfg80211_chandef_create() is called universally to create the
default chandef during hw registration, however it only really
makes sense to be used for 2GHz, 5GHz, and 6GHz (and by extension
the 'LC' band) as it relies on the channel type which is only
relevant to those specific bands.

To reduce some confusion, create a generic helper for creating the
default chandef that makes sense for all supported bands.

Suggested-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Lachlan Hodges <lachlan.hodges@morsemicro.com>
Link: https://patch.msgid.link/20260312045804.362974-2-lachlan.hodges@morsemicro.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Lachlan Hodges and committed by
Johannes Berg
a6d4291e 84674b03

+15 -3
+15 -3
net/mac80211/main.c
··· 1118 1118 return true; 1119 1119 } 1120 1120 1121 + static void ieee80211_create_default_chandef(struct cfg80211_chan_def *chandef, 1122 + struct ieee80211_channel *chan) 1123 + { 1124 + *chandef = (struct cfg80211_chan_def) { 1125 + .chan = chan, 1126 + .width = chan->band == NL80211_BAND_S1GHZ ? 1127 + NL80211_CHAN_WIDTH_1 : 1128 + NL80211_CHAN_WIDTH_20_NOHT, 1129 + .center_freq1 = chan->center_freq, 1130 + .freq1_offset = chan->freq_offset, 1131 + }; 1132 + } 1133 + 1121 1134 int ieee80211_register_hw(struct ieee80211_hw *hw) 1122 1135 { 1123 1136 struct ieee80211_local *local = hw_to_local(hw); ··· 1274 1261 /* if none found then use the first anyway */ 1275 1262 if (i == sband->n_channels) 1276 1263 i = 0; 1277 - cfg80211_chandef_create(&dflt_chandef, 1278 - &sband->channels[i], 1279 - NL80211_CHAN_NO_HT); 1264 + ieee80211_create_default_chandef(&dflt_chandef, 1265 + &sband->channels[i]); 1280 1266 /* init channel we're on */ 1281 1267 local->monitor_chanreq.oper = dflt_chandef; 1282 1268 if (local->emulate_chanctx) {