On Tue, 2022-08-16 at 08:03 +0800, sean.wang@xxxxxxxxxxxx wrote: > From: Sean Wang <sean.wang@xxxxxxxxxxxx> > > MT7921 device can be supported with the channel context depending on > the newer firmware so that we need a way to enable the chanctx related > methods until hw is being registered. > > Signed-off-by: Sean Wang <sean.wang@xxxxxxxxxxxx> > --- > net/mac80211/main.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/net/mac80211/main.c b/net/mac80211/main.c > index 5b1c47ed0cc0..98d05ed1a081 100644 > --- a/net/mac80211/main.c > +++ b/net/mac80211/main.c > @@ -1011,6 +1011,14 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) > return -EINVAL; > #endif > > + /* check all or no channel context operations exist */ > + i = !!local->ops->add_chanctx + !!local->ops->remove_chanctx + > + !!local->ops->change_chanctx + !!local->ops->assign_vif_chanctx + > + !!local->ops->unassign_vif_chanctx; > + if (WARN_ON(i != 0 && i != 5)) > + return -EINVAL; > + local->use_chanctx = i == 5; > + Not sure I understand this - this just *adds* code, based on the description I would've expected you to *move* code? In any case, I'm not sure I see how this makes sense - ops is supposed to be const, and you're supposed to pass it to alloc_hw already, so how would it change?! Also, conceptually, I'm not sure why it's needed to alloc_hw before loading firmware, we also have a lot of things depend on the firmware capabilities in iwlwifi/mvm, and so we alloc/register HW after loading firmware. johannes