All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miri Korenblit <miriam.rachel.korenblit@intel.com>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org, Johannes Berg <johannes.berg@intel.com>
Subject: [PATCH 15/15] wifi: iwlwifi: mvm: refactor duplicate chanctx condition
Date: Mon, 29 Jan 2024 21:22:03 +0200	[thread overview]
Message-ID: <20240129211905.6fcde4051adf.I343934874612d21727ed167accaa967958b2c25b@changeid> (raw)
In-Reply-To: <20240129192203.4189915-1-miriam.rachel.korenblit@intel.com>

From: Johannes Berg <johannes.berg@intel.com>

Refactor the check for using a chanctx's def vs. min_def,
to have the same in both places and reuse it later.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 12 ++++--------
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h      | 13 +++++++++++++
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 843544cfcfe9..dbad30e61451 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -4810,8 +4810,8 @@ static void iwl_mvm_ftm_responder_chanctx_iter(void *_data, u8 *mac,
 		data->responder = true;
 }
 
-static bool iwl_mvm_is_ftm_responder_chanctx(struct iwl_mvm *mvm,
-					     struct ieee80211_chanctx_conf *ctx)
+bool iwl_mvm_is_ftm_responder_chanctx(struct iwl_mvm *mvm,
+				      struct ieee80211_chanctx_conf *ctx)
 {
 	struct iwl_mvm_ftm_responder_iter_data data = {
 		.responder = false,
@@ -4830,9 +4830,7 @@ static int __iwl_mvm_add_chanctx(struct iwl_mvm *mvm,
 {
 	u16 *phy_ctxt_id = (u16 *)ctx->drv_priv;
 	struct iwl_mvm_phy_ctxt *phy_ctxt;
-	bool use_def = iwl_mvm_is_ftm_responder_chanctx(mvm, ctx) ||
-		iwl_mvm_enable_fils(mvm, ctx);
-	struct cfg80211_chan_def *def = use_def ? &ctx->def : &ctx->min_def;
+	struct cfg80211_chan_def *def = iwl_mvm_chanctx_def(mvm, ctx);
 	int ret;
 
 	lockdep_assert_held(&mvm->mutex);
@@ -4898,9 +4896,7 @@ void iwl_mvm_change_chanctx(struct ieee80211_hw *hw,
 	struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
 	u16 *phy_ctxt_id = (u16 *)ctx->drv_priv;
 	struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id];
-	bool use_def = iwl_mvm_is_ftm_responder_chanctx(mvm, ctx) ||
-		iwl_mvm_enable_fils(mvm, ctx);
-	struct cfg80211_chan_def *def = use_def ? &ctx->def : &ctx->min_def;
+	struct cfg80211_chan_def *def = iwl_mvm_chanctx_def(mvm, ctx);
 
 	if (WARN_ONCE((phy_ctxt->ref > 1) &&
 		      (changed & ~(IEEE80211_CHANCTX_CHANGE_WIDTH |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index e148ef02ff73..d414007c4755 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -2752,4 +2752,17 @@ void iwl_mvm_mld_select_links(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 int iwl_mvm_mld_get_primary_link(struct iwl_mvm *mvm,
 				 struct ieee80211_vif *vif,
 				 unsigned long usable_links);
+
+bool iwl_mvm_is_ftm_responder_chanctx(struct iwl_mvm *mvm,
+				      struct ieee80211_chanctx_conf *ctx);
+
+static inline struct cfg80211_chan_def *
+iwl_mvm_chanctx_def(struct iwl_mvm *mvm, struct ieee80211_chanctx_conf *ctx)
+{
+	bool use_def = iwl_mvm_is_ftm_responder_chanctx(mvm, ctx) ||
+		iwl_mvm_enable_fils(mvm, ctx);
+
+	return use_def ? &ctx->def : &ctx->min_def;
+}
+
 #endif /* __IWL_MVM_H__ */
-- 
2.34.1


      parent reply	other threads:[~2024-01-29 19:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-29 19:21 [PATCH 00/15] wifi: iwlwifi: updates - 2024-01-29 Miri Korenblit
2024-01-29 19:21 ` [PATCH 01/15] wifi: iwlwifi: fix EWRD table validity check Miri Korenblit
2024-01-29 19:21 ` [PATCH 02/15] wifi: iwlwifi: mvm: add support for TID to link mapping neg request Miri Korenblit
2024-01-29 19:21 ` [PATCH 03/15] wifi: iwlwifi: mvm: d3: fix IPN byte order Miri Korenblit
2024-01-29 19:21 ` [PATCH 04/15] wifi: iwlwifi: Fix spelling mistake "SESION" -> "SESSION" Miri Korenblit
2024-01-29 19:21 ` [PATCH 05/15] wifi: iwlwifi: mvm: don't set trigger frame padding in AP mode Miri Korenblit
2024-01-29 19:21 ` [PATCH 06/15] wifi: iwlwifi: always have 'uats_enabled' Miri Korenblit
2024-01-29 19:21 ` [PATCH 07/15] wifi: iwlwifi: mvm: Fix FTM initiator flags Miri Korenblit
2024-01-29 19:21 ` [PATCH 08/15] wifi: iwlwifi: mvm: Add support for removing responder TKs Miri Korenblit
2024-01-29 19:21 ` [PATCH 09/15] wifi: iwlwifi: remove Gl A-step remnants Miri Korenblit
2024-01-29 19:21 ` [PATCH 10/15] wifi: iwlwifi: mvm: use FW rate for non-data only on new devices Miri Korenblit
2024-01-29 19:21 ` [PATCH 11/15] wifi: iwlwifi: mvm: fix the TLC command after ADD_STA Miri Korenblit
2024-01-29 19:22 ` [PATCH 12/15] wifi: iwlwifi: pcie: Add the PCI device id for new hardware Miri Korenblit
2024-01-29 19:22 ` [PATCH 13/15] wifi: iwlwifi: mvm: support SPP A-MSDUs Miri Korenblit
2024-01-29 19:22 ` [PATCH 14/15] wifi: iwlwifi: mvm: log dropped packets due to MIC error Miri Korenblit
2024-01-29 19:22 ` Miri Korenblit [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240129211905.6fcde4051adf.I343934874612d21727ed167accaa967958b2c25b@changeid \
    --to=miriam.rachel.korenblit@intel.com \
    --cc=johannes.berg@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.