From: Matej Dujava <mdujava@kocurkovo.cz>
To: Forest Bond <forest@alittletooquiet.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Cc: Stefano Brivio <sbrivio@redhat.com>,
Briana Oursler <briana.oursler@gmail.com>,
"Frank A. Cancio Bello" <frank@generalsoftwareinc.com>,
Matej Dujava <mdujava@kocurkovo.cz>
Subject: [PATCH 5/5] staging: vt6655: extract index manupulation out of function call
Date: Sun, 3 May 2020 15:29:12 +0200 [thread overview]
Message-ID: <1588512552-12297-6-git-send-email-mdujava@kocurkovo.cz> (raw)
In-Reply-To: <1588512552-12297-1-git-send-email-mdujava@kocurkovo.cz>
This patch will remove if/else by selecting proper argument before
function call, also index is updated before function call.
Signed-off-by: Matej Dujava <mdujava@kocurkovo.cz>
---
drivers/staging/vt6655/rxtx.c | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index c4d62c27f1c1..1e025bb72810 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -266,7 +266,8 @@ s_uGetDataDuration(
return 0;
} else {
/* First Frag or Mid Frag */
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, len, wRate, bNeedAck);
+ uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType,
+ len, wRate, bNeedAck);
}
return pDevice->uSIFS + uAckTime + uNextPktTime;
@@ -283,8 +284,8 @@ s_uGetDataDuration(
return 0;
} else {
/* First Frag or Mid Frag */
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, len,
- wRate, bNeedAck);
+ uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType,
+ len, wRate, bNeedAck);
}
return pDevice->uSIFS + uAckTime + uNextPktTime;
@@ -307,17 +308,15 @@ s_uGetDataDuration(
else if (wRate > RATE_54M)
wRate = RATE_54M;
- if (byFBOption == AUTO_FB_0) {
- uNextPktTime = s_uGetTxRsvTime(pDevice,
- byPktType, len,
- wFB_Opt0[FB_RATE0][wRate - RATE_18M],
- bNeedAck);
- } else {
- uNextPktTime = s_uGetTxRsvTime(pDevice,
- byPktType, len,
- wFB_Opt1[FB_RATE0][wRate - RATE_18M],
- bNeedAck);
- }
+ wRate -= RATE_18M;
+
+ if (byFBOption == AUTO_FB_0)
+ wRate = wFB_Opt0[FB_RATE0][wRate];
+ else
+ wRate = wFB_Opt1[FB_RATE0][wRate];
+
+ uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType,
+ len, wRate, bNeedAck);
}
return pDevice->uSIFS + uAckTime + uNextPktTime;
--
2.26.2
prev parent reply other threads:[~2020-05-03 13:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-03 13:29 [PATCH 0/5] Cleaning s_uGetDataDuration function Matej Dujava
2020-05-03 13:29 ` [PATCH 1/5] staging: vt6655: merge two switch cases in s_uGetDataDuration Matej Dujava
2020-05-03 13:29 ` [PATCH 2/5] staging: vt6655: do calculation of uAckTime first Matej Dujava
2020-05-03 13:29 ` [PATCH 3/5] staging: vt6655: remove else after return and invert condition Matej Dujava
2020-05-03 13:29 ` [PATCH 4/5] staging: vt6655: return at the ond of case body Matej Dujava
2020-05-03 13:29 ` Matej Dujava [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=1588512552-12297-6-git-send-email-mdujava@kocurkovo.cz \
--to=mdujava@kocurkovo.cz \
--cc=briana.oursler@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=forest@alittletooquiet.net \
--cc=frank@generalsoftwareinc.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sbrivio@redhat.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
all inboxes | Powered by JetHome®