linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: kvalo@codeaurora.org
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH 08/12] iwlwifi: scan: Create function to build scan cmd
Date: Sat, 19 Oct 2019 12:38:58 +0300	[thread overview]
Message-ID: <20191019093902.29823-6-luca@coelho.fi> (raw)
In-Reply-To: <20191019093902.29823-1-luca@coelho.fi>

From: Tova Mussai <tova.mussai@intel.com>

Currently, the code to build scan cmd is duplicated in
iwl_mvm_reg_scan_start and iwl_mvm_sched_scan_start.

Create a function to build this command, and call the function instead.

Signed-off-by: Tova Mussai <tova.mussai@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 32 ++++++++++---------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
index 538cd7b2018b..7ea395681c94 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
@@ -1712,6 +1712,20 @@ static void iwl_mvm_fill_scan_type(struct iwl_mvm *mvm,
 	}
 }
 
+static int iwl_mvm_build_scan_cmd(struct iwl_mvm *mvm,
+				  struct ieee80211_vif *vif,
+				  struct iwl_host_cmd *hcmd,
+				  struct iwl_mvm_scan_params *params,
+				  int type)
+{
+	if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) {
+		hcmd->id = iwl_cmd_id(SCAN_REQ_UMAC, IWL_ALWAYS_LONG_GROUP, 0);
+		return  iwl_mvm_scan_umac(mvm, vif, params, type);
+	}
+	hcmd->id = SCAN_OFFLOAD_REQUEST_CMD;
+	return  iwl_mvm_scan_lmac(mvm, vif, params);
+}
+
 int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 			   struct cfg80211_scan_request *req,
 			   struct ieee80211_scan_ies *ies)
@@ -1769,14 +1783,8 @@ int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 
 	iwl_mvm_build_scan_probe(mvm, vif, ies, &params);
 
-	if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) {
-		hcmd.id = iwl_cmd_id(SCAN_REQ_UMAC, IWL_ALWAYS_LONG_GROUP, 0);
-		ret = iwl_mvm_scan_umac(mvm, vif, &params,
-					IWL_MVM_SCAN_REGULAR);
-	} else {
-		hcmd.id = SCAN_OFFLOAD_REQUEST_CMD;
-		ret = iwl_mvm_scan_lmac(mvm, vif, &params);
-	}
+	ret = iwl_mvm_build_scan_cmd(mvm, vif, &hcmd, &params,
+				     IWL_MVM_SCAN_REGULAR);
 
 	if (ret)
 		return ret;
@@ -1874,13 +1882,7 @@ int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm,
 
 	iwl_mvm_build_scan_probe(mvm, vif, ies, &params);
 
-	if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) {
-		hcmd.id = iwl_cmd_id(SCAN_REQ_UMAC, IWL_ALWAYS_LONG_GROUP, 0);
-		ret = iwl_mvm_scan_umac(mvm, vif, &params, type);
-	} else {
-		hcmd.id = SCAN_OFFLOAD_REQUEST_CMD;
-		ret = iwl_mvm_scan_lmac(mvm, vif, &params);
-	}
+	ret = iwl_mvm_build_scan_cmd(mvm, vif, &hcmd, &params, type);
 
 	if (ret)
 		return ret;
-- 
2.23.0


  parent reply	other threads:[~2019-10-19  9:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-19  9:38 [PATCH 00/12] iwlwifi: updates intended for v5.5 2019-19 Luca Coelho
2019-10-19  9:38 ` [PATCH 01/12] iwlwifi: mvm: fix support for single antenna diversity Luca Coelho
2019-10-19  9:38 ` [PATCH 02/12] iwlwifi: mvm: remove else-if in iwl_send_phy_cfg_cmd() Luca Coelho
2019-10-19  9:38 ` [PATCH 03/12] iwlwifi: nvm: update iwl_uhb_nvm_channels Luca Coelho
2019-10-25  7:46   ` Kalle Valo
2019-11-13  8:53     ` Luca Coelho
2019-11-13  9:29   ` [PATCH v2] " Luca Coelho
2019-11-13 13:20     ` Kalle Valo
2019-10-19  9:38 ` [PATCH 04/12] iwlwifi: mvm: in VHT connection use only VHT capabilities Luca Coelho
2019-10-19  9:38 ` [PATCH 05/12] iwlwifi: pcie: make iwl_pcie_gen2_update_byte_tbl static Luca Coelho
2019-10-19  9:38 ` [PATCH 06/12] iwlwifi: dbg_ini: support dump collection upon assert during D3 Luca Coelho
2019-10-19  9:38 ` [PATCH 07/12] iwlwifi: scan: create function for scan scheduling params Luca Coelho
2019-10-19  9:38 ` Luca Coelho [this message]
2019-10-19  9:38 ` [PATCH 09/12] iwlwifi: scan: adapt the code to use api ver 11 Luca Coelho
2019-10-19  9:39 ` [PATCH 10/12] iwlwifi: mvm: print rate_n_flags in a pretty format Luca Coelho
2019-10-19  9:39 ` [PATCH 11/12] iwlwifi: FW API: reference enum in docs of modify_mask Luca Coelho
2019-10-19  9:39 ` [PATCH 12/12] iwlwifi: bump FW API to 51 for 22000 series Luca Coelho

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=20191019093902.29823-6-luca@coelho.fi \
    --to=luca@coelho.fi \
    --cc=kvalo@codeaurora.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).