All of lore.kernel.org
 help / color / mirror / Atom feed
From: gregory.greenman@intel.com
To: kvalo@kernel.org, johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org,
	Johannes Berg <johannes.berg@intel.com>,
	Gregory Greenman <gregory.greenman@intel.com>
Subject: [PATCH 05/15] wifi: iwlwifi: mvm: refactor iwl_mvm_set_sta_rate() a bit
Date: Tue,  6 Sep 2022 16:42:09 +0300	[thread overview]
Message-ID: <20220906161827.623e32931b67.Id743a7879e84ae37a849179e536c58b1bf55380f@changeid> (raw)
In-Reply-To: <20220906134219.365090-1-gregory.greenman@intel.com>

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

Use a switch statement over the rate type instead of the
if chain, to simplify.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
---
 .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 25 +++++++++----------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 5eb28f8ee87e..735d5ed412d1 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -4949,6 +4949,7 @@ static int iwl_mvm_mac_get_survey(struct ieee80211_hw *hw, int idx,
 static void iwl_mvm_set_sta_rate(u32 rate_n_flags, struct rate_info *rinfo)
 {
 	u32 format = rate_n_flags & RATE_MCS_MOD_TYPE_MSK;
+	u32 gi_ltf;
 
 	switch (rate_n_flags & RATE_MCS_CHAN_WIDTH_MSK) {
 	case RATE_MCS_CHAN_WIDTH_20:
@@ -5019,9 +5020,12 @@ static void iwl_mvm_set_sta_rate(u32 rate_n_flags, struct rate_info *rinfo)
 		RATE_HT_MCS_INDEX(rate_n_flags) :
 		u32_get_bits(rate_n_flags, RATE_MCS_CODE_MSK);
 
-	if (format == RATE_MCS_HE_MSK) {
-		u32 gi_ltf = u32_get_bits(rate_n_flags,
-					  RATE_MCS_HE_GI_LTF_MSK);
+	if (rate_n_flags & RATE_MCS_SGI_MSK)
+		rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI;
+
+	switch (format) {
+	case RATE_MCS_HE_MSK:
+		gi_ltf = u32_get_bits(rate_n_flags, RATE_MCS_HE_GI_LTF_MSK);
 
 		rinfo->flags |= RATE_INFO_FLAGS_HE_MCS;
 
@@ -5060,19 +5064,14 @@ static void iwl_mvm_set_sta_rate(u32 rate_n_flags, struct rate_info *rinfo)
 
 		if (rate_n_flags & RATE_HE_DUAL_CARRIER_MODE_MSK)
 			rinfo->he_dcm = 1;
-		return;
-	}
-
-	if (rate_n_flags & RATE_MCS_SGI_MSK)
-		rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI;
-
-	if (format == RATE_MCS_HT_MSK) {
+		break;
+	case RATE_MCS_HT_MSK:
 		rinfo->flags |= RATE_INFO_FLAGS_MCS;
-
-	} else if (format == RATE_MCS_VHT_MSK) {
+		break;
+	case RATE_MCS_VHT_MSK:
 		rinfo->flags |= RATE_INFO_FLAGS_VHT_MCS;
+		break;
 	}
-
 }
 
 static void iwl_mvm_mac_sta_statistics(struct ieee80211_hw *hw,
-- 
2.35.3


  parent reply	other threads:[~2022-09-06 14:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06 13:42 [PATCH 00/15] iwlwifi: updates intended for v6.0 gregory.greenman
2022-09-06 13:42 ` [PATCH 01/15] wifi: iwlwifi: pcie: add support for BZ devices gregory.greenman
2022-09-06 13:42 ` [PATCH 02/15] wifi: iwlwifi: mvm: fix typo in struct iwl_rx_no_data API gregory.greenman
2022-09-06 13:42 ` [PATCH 03/15] wifi: iwlwifi: mvm: rxmq: refactor mac80211 rx_status setting gregory.greenman
2022-09-06 13:42 ` [PATCH 04/15] wifi: iwlwifi: mvm: rxmq: further unify some VHT/HE code gregory.greenman
2022-09-06 13:42 ` gregory.greenman [this message]
2022-09-06 13:42 ` [PATCH 06/15] wifi: iwlwifi: cfg: remove IWL_DEVICE_BZ_COMMON macro gregory.greenman
2022-09-06 13:42 ` [PATCH 07/15] wifi: iwlwifi: mvm: don't check D0I3 version gregory.greenman
2022-09-06 13:42 ` [PATCH 08/15] wifi: iwlwifi: mvm: Add support for wowlan info notification gregory.greenman
2022-09-06 13:42 ` [PATCH 09/15] wifi: iwlwifi: mvm: Add support for wowlan wake packet notification gregory.greenman
2022-09-06 13:42 ` [PATCH 10/15] wifi: iwlwifi: mvm: Add support for d3 end notification gregory.greenman
2022-09-06 13:42 ` [PATCH 11/15] wifi: iwlwifi: mvm: enable resume based on notifications gregory.greenman
2022-09-06 13:42 ` [PATCH 12/15] wifi: iwlwifi: mvm: Add handling for scan offload match info notification gregory.greenman
2022-09-06 13:42 ` [PATCH 13/15] wifi: iwlwifi: mvm: trigger resume flow before wait for notifications gregory.greenman
2022-09-06 13:42 ` [PATCH 14/15] wifi: iwlwifi: mvm: iterate over interfaces after an assert in d3 gregory.greenman
2022-09-06 13:42 ` [PATCH 15/15] wifi: iwlwifi: mvm: d3: parse keys from wowlan info notification gregory.greenman
2022-09-06 13:48 ` [PATCH 00/15] iwlwifi: updates intended for v6.0 Greenman, Gregory

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=20220906161827.623e32931b67.Id743a7879e84ae37a849179e536c58b1bf55380f@changeid \
    --to=gregory.greenman@intel.com \
    --cc=johannes.berg@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=kvalo@kernel.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 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.