linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tuomo Rinne <tuomo.rinne@gmail.com>
To: gregkh@linuxfoundation.org
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] staging: rtl8192u: Improve code readability
Date: Sat, 29 Apr 2017 12:35:05 +0100	[thread overview]
Message-ID: <1493465706-16290-2-git-send-email-tuomo.rinne@gmail.com> (raw)
In-Reply-To: <1493465706-16290-1-git-send-email-tuomo.rinne@gmail.com>

Split the u4bAcParam parameter construction to multiple lines for easier
readability.

Signed-off-by: Tuomo Rinne <tuomo.rinne@gmail.com>
---
 drivers/staging/rtl8192u/r8192U_dm.c | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c
index 16cafb62..5e84ed7 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -2300,20 +2300,30 @@ static void dm_check_edca_turbo(
 		 * Restore original EDCA according to the declaration of AP.
 		 */
 		if (priv->bcurrent_turbo_EDCA) {
-			u8		u1bAIFS;
-			u32		u4bAcParam;
+			u8	u1bAIFS;
+			u32	u4bAcParam, op_limit, cw_max, cw_min;
+
 			struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters;
 			u8 mode = priv->ieee80211->mode;
 
 			/*  For Each time updating EDCA parameter, reset EDCA turbo mode status. */
 			dm_init_edca_turbo(dev);
-			u1bAIFS = qos_parameters->aifs[0] * ((mode&(IEEE_G|IEEE_N_24G)) ? 9 : 20) + aSifsTime;
-			u4bAcParam = (((le16_to_cpu(qos_parameters->tx_op_limit[0])) << AC_PARAM_TXOP_LIMIT_OFFSET)|
-				((le16_to_cpu(qos_parameters->cw_max[0])) << AC_PARAM_ECW_MAX_OFFSET)|
-				((le16_to_cpu(qos_parameters->cw_min[0])) << AC_PARAM_ECW_MIN_OFFSET)|
-				((u32)u1bAIFS << AC_PARAM_AIFS_OFFSET));
-			/*write_nic_dword(dev, WDCAPARA_ADD[i], u4bAcParam);*/
-			write_nic_dword(dev, EDCAPARA_BE,  u4bAcParam);
+
+			u1bAIFS = qos_parameters->aifs[0] * ((mode & (IEEE_G | IEEE_N_24G)) ? 9 : 20) + aSifsTime;
+
+			op_limit = (u32)le16_to_cpu(qos_parameters->tx_op_limit[0]);
+			cw_max   = (u32)le16_to_cpu(qos_parameters->cw_max[0]);
+			cw_min   = (u32)le16_to_cpu(qos_parameters->cw_min[0]);
+
+			op_limit <<= AC_PARAM_TXOP_LIMIT_OFFSET;
+			cw_max   <<= AC_PARAM_ECW_MAX_OFFSET;
+			cw_min   <<= AC_PARAM_ECW_MIN_OFFSET;
+			u1bAIFS  <<= AC_PARAM_AIFS_OFFSET;
+
+			u4bAcParam = op_limit | cw_max | cw_min | u1bAIFS;
+
+			write_nic_dword(dev, EDCAPARA_BE, u4bAcParam);
+
 
 			/*
 			 * Check ACM bit.
-- 
2.1.4

  reply	other threads:[~2017-04-29 11:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-22 22:55 [PATCH] staging: rtl8192u: Improve readability and fix sparse warnings: cast from restricted __le16 Tuomo Rinne
2017-04-28 10:27 ` Greg KH
2017-04-29 11:35   ` [PATCH 1/3] staging: rtl8192u: Remove unnecessary scope Tuomo Rinne
2017-04-29 11:35     ` Tuomo Rinne [this message]
2017-04-29 11:35     ` [PATCH 3/3] staging: rtl8192u: Convert u4bAcParam back to little-endian after construction Tuomo Rinne
2017-04-29 18:07       ` kbuild test robot
2017-05-01 17:11         ` Fix kbuild warnings Tuomo Rinne
2017-05-01 17:11           ` [PATCH 1/1] staging: rtl8192u: Convert u4bAcParam back to little-endian after construction Tuomo Rinne
2017-05-01 21:34             ` Greg KH
2017-05-01 22:53               ` Tuomo
2017-05-01 22:46 [PATCH 0/3] staging: rtl8192u: Refactor u4bAcParam construction Tuomo Rinne
2017-05-01 22:46 ` [PATCH 2/3] staging: rtl8192u: Improve code readability Tuomo Rinne

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=1493465706-16290-2-git-send-email-tuomo.rinne@gmail.com \
    --to=tuomo.rinne@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@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).