summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLachlan Hodges <lachlan.hodges@morsemicro.com>2026-03-12 07:58:02 +0300
committerJohannes Berg <johannes.berg@intel.com>2026-03-13 09:14:26 +0300
commita6d4291eae0409e63525d3b26f44feae6f6f4659 (patch)
treebcf9319bf8e5c220f0e1dc4de117e1ff30ab64c0
parent84674b03d8bf3a850f023a98136c27909f0a2b61 (diff)
downloadlinux-a6d4291eae0409e63525d3b26f44feae6f6f4659.tar.xz
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>
-rw-r--r--net/mac80211/main.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index b0451f1c8e79..d1bb6353908d 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -1118,6 +1118,19 @@ ieee80211_ifcomb_check(const struct ieee80211_iface_combination *c, int n_comb)
return true;
}
+static void ieee80211_create_default_chandef(struct cfg80211_chan_def *chandef,
+ struct ieee80211_channel *chan)
+{
+ *chandef = (struct cfg80211_chan_def) {
+ .chan = chan,
+ .width = chan->band == NL80211_BAND_S1GHZ ?
+ NL80211_CHAN_WIDTH_1 :
+ NL80211_CHAN_WIDTH_20_NOHT,
+ .center_freq1 = chan->center_freq,
+ .freq1_offset = chan->freq_offset,
+ };
+}
+
int ieee80211_register_hw(struct ieee80211_hw *hw)
{
struct ieee80211_local *local = hw_to_local(hw);
@@ -1261,9 +1274,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
/* if none found then use the first anyway */
if (i == sband->n_channels)
i = 0;
- cfg80211_chandef_create(&dflt_chandef,
- &sband->channels[i],
- NL80211_CHAN_NO_HT);
+ ieee80211_create_default_chandef(&dflt_chandef,
+ &sband->channels[i]);
/* init channel we're on */
local->monitor_chanreq.oper = dflt_chandef;
if (local->emulate_chanctx) {