Linux wireless drivers development
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: kvalo@codeaurora.org
Cc: linux-wireless@vger.kernel.org,
	Sara Sharon <sara.sharon@intel.com>,
	Luca Coelho <luciano.coelho@intel.com>
Subject: [PATCH 10/17] iwlwifi: mvm: refactor iwl_mvm_flush_no_vif
Date: Sun, 29 Oct 2017 14:28:09 +0200	[thread overview]
Message-ID: <20171029122816.8802-11-luca@coelho.fi> (raw)
In-Reply-To: <20171029122816.8802-1-luca@coelho.fi>

From: Sara Sharon <sara.sharon@intel.com>

This function is very indented and hard to read.
Refactor it.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 40 +++++++++++------------
 1 file changed, 19 insertions(+), 21 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 26caea62df9b..941dbdebe143 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -4002,6 +4002,8 @@ static int iwl_mvm_post_channel_switch(struct ieee80211_hw *hw,
 
 static void iwl_mvm_flush_no_vif(struct iwl_mvm *mvm, u32 queues, bool drop)
 {
+	int i;
+
 	if (drop) {
 		if (iwl_mvm_has_new_tx_api(mvm))
 			/* TODO new tx api */
@@ -4009,32 +4011,28 @@ static void iwl_mvm_flush_no_vif(struct iwl_mvm *mvm, u32 queues, bool drop)
 				  "Need to implement flush TX queue\n");
 		else
 			iwl_mvm_flush_tx_path(mvm,
-				iwl_mvm_flushable_queues(mvm) & queues,
-				0);
-	} else {
-		if (iwl_mvm_has_new_tx_api(mvm)) {
-			struct ieee80211_sta *sta;
-			int i;
+				iwl_mvm_flushable_queues(mvm) & queues, 0);
+		return;
+	}
 
-			mutex_lock(&mvm->mutex);
+	if (!iwl_mvm_has_new_tx_api(mvm)) {
+		iwl_trans_wait_tx_queues_empty(mvm->trans, queues);
+		return;
+	}
 
-			for (i = 0; i < ARRAY_SIZE(mvm->fw_id_to_mac_id); i++) {
-				sta = rcu_dereference_protected(
-						mvm->fw_id_to_mac_id[i],
-						lockdep_is_held(&mvm->mutex));
-				if (IS_ERR_OR_NULL(sta))
-					continue;
+	mutex_lock(&mvm->mutex);
+	for (i = 0; i < ARRAY_SIZE(mvm->fw_id_to_mac_id); i++) {
+		struct ieee80211_sta *sta;
 
-				iwl_mvm_wait_sta_queues_empty(mvm,
-						iwl_mvm_sta_from_mac80211(sta));
-			}
+		sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i],
+						lockdep_is_held(&mvm->mutex));
+		if (IS_ERR_OR_NULL(sta))
+			continue;
 
-			mutex_unlock(&mvm->mutex);
-		} else {
-			iwl_trans_wait_tx_queues_empty(mvm->trans,
-						       queues);
-		}
+		iwl_mvm_wait_sta_queues_empty(mvm,
+					      iwl_mvm_sta_from_mac80211(sta));
 	}
+	mutex_unlock(&mvm->mutex);
 }
 
 static void iwl_mvm_mac_flush(struct ieee80211_hw *hw,
-- 
2.14.2

  parent reply	other threads:[~2017-10-29 12:29 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-29 12:27 [PATCH 00/17] iwlwifi: updates intended for v4.15 2017-10-29 Luca Coelho
2017-10-29 12:28 ` [PATCH 01/17] iwlwifi: mvm: use RS macro instead of duplicating the code Luca Coelho
2017-10-29 12:28 ` [PATCH 02/17] iwlwifi: mvm: cleanup references to aggregation count limit Luca Coelho
2017-10-29 12:28 ` [PATCH 03/17] iwlwifi: mvm: reset seq num after restart Luca Coelho
2017-10-29 12:28 ` [PATCH 04/17] iwlwifi: mvm: rs: remove the ANT C from the toogle antenna logic Luca Coelho
2017-10-29 12:28 ` [PATCH 05/17] iwlwifi: mvm: improve latency when there is a reorder timeout Luca Coelho
2017-10-29 12:28 ` [PATCH 06/17] iwlwifi: remove dead code for internal devices only Luca Coelho
2017-10-29 12:28 ` [PATCH 07/17] iwlwifi: remove host assisted paging Luca Coelho
2017-10-29 12:28 ` [PATCH 08/17] iwlwifi: Add more call-sites for pcie reg dumper Luca Coelho
2017-10-29 12:28 ` [PATCH 09/17] iwlwifi: fix multi queue notification for a000 devices Luca Coelho
2017-10-29 12:28 ` Luca Coelho [this message]
2017-10-29 12:28 ` [PATCH 11/17] iwlwifi: mvm: add missing implementation of flush " Luca Coelho
2017-10-29 12:28 ` [PATCH 12/17] iwlwifi: mvm: hold mutex when flushing in iwl_mvm_flush_no_vif() Luca Coelho
2017-10-29 12:28 ` [PATCH 13/17] iwlwifi: mvm: Convert timers to use timer_setup() Luca Coelho
2017-11-06 19:45   ` Kees Cook
2017-11-06 19:48     ` Luca Coelho
2017-11-06 20:40       ` Kees Cook
2017-10-29 12:28 ` [PATCH 14/17] iwlwifi: drop RX frames during hardware restart Luca Coelho
2017-10-29 12:28 ` [PATCH 15/17] iwlwifi: add new cards for 8260 series Luca Coelho
2017-10-29 12:28 ` [PATCH 16/17] iwlwifi: add new cards for 8265 series Luca Coelho
2017-10-29 12:28 ` [PATCH 17/17] iwlwifi: add new cards for a000 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=20171029122816.8802-11-luca@coelho.fi \
    --to=luca@coelho.fi \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=luciano.coelho@intel.com \
    --cc=sara.sharon@intel.com \
    /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