From: "Milan Lakhani" <milan.lakhani@codethink.co.uk>
To: gregkh@linuxfoundation.org, lukas.bulwahn@gmail.com,
linux-kernel@vger.kernel.org, linux-safety@lists.elisa.tech,
forest@alittletooquiet.net
Cc: Milan Lakhani <milan.lakhani@codethink.co.uk>
Subject: [linux-safety] [PATCH v2 2/2] staging: vt6655: Use macro in rxtx.c
Date: Tue, 24 Nov 2020 10:48:56 +0000 [thread overview]
Message-ID: <1606214936-35192-2-git-send-email-milan.lakhani@codethink.co.uk> (raw)
In-Reply-To: <1606214936-35192-1-git-send-email-milan.lakhani@codethink.co.uk>
Use macro for repeated function to get the data duration and timestamp,
correcting line length and alignment warnings in rxtx.c. Reported by
checkpatch.
Signed-off-by: Milan Lakhani <milan.lakhani@codethink.co.uk>
---
drivers/staging/vt6655/rxtx.c | 51 ++++++++++++++++---------------------------
1 file changed, 19 insertions(+), 32 deletions(-)
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 508e1bd..c5dfe3c 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -423,6 +423,10 @@ s_uGetRTSCTSDuration(
return cpu_to_le16((u16)uDurTime);
}
+#define getDurationTimeStamp(byDurType, byPktType, wRate) \
+ (cpu_to_le16((u16)s_uGetDataDuration(pDevice, (byDurType), cbFrameLength, (byPktType), \
+ (wRate), bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)))
+
static
__le16
s_uFillDataHead(
@@ -467,15 +471,10 @@ s_uFillDataHead(
} else {
/* Get Duration and TimeStamp */
buf->duration_a =
- cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength,
- byPktType, wCurrentRate, bNeedAck, uFragIdx,
- cbLastFragmentSize, uMACfragNum,
- byFBOption));
+ getDurationTimeStamp(DATADUR_A, byPktType, wCurrentRate);
buf->duration_b =
- cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength,
- PK_TYPE_11B, pDevice->byTopCCKBasicRate,
- bNeedAck, uFragIdx, cbLastFragmentSize,
- uMACfragNum, byFBOption));
+ getDurationTimeStamp(DATADUR_B, PK_TYPE_11B,
+ pDevice->byTopCCKBasicRate);
}
buf->time_stamp_off_a = vnt_time_stamp_off(pDevice, wCurrentRate);
@@ -492,14 +491,11 @@ s_uFillDataHead(
pDevice->byTopCCKBasicRate,
PK_TYPE_11B, &buf->b);
/* Get Duration and TimeStamp */
- buf->duration_a = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
- buf->duration_b = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, PK_TYPE_11B,
- pDevice->byTopCCKBasicRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
- buf->duration_a_f0 = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
- buf->duration_a_f1 = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
+ buf->duration_a = getDurationTimeStamp(DATADUR_A, byPktType, wCurrentRate);
+ buf->duration_b = getDurationTimeStamp(DATADUR_B, PK_TYPE_11B,
+ pDevice->byTopCCKBasicRate);
+ buf->duration_a_f0 = getDurationTimeStamp(DATADUR_A_F0, byPktType, wCurrentRate);
+ buf->duration_a_f1 = getDurationTimeStamp(DATADUR_A_F1, byPktType, wCurrentRate);
buf->time_stamp_off_a = vnt_time_stamp_off(pDevice, wCurrentRate);
buf->time_stamp_off_b = vnt_time_stamp_off(pDevice, pDevice->byTopCCKBasicRate);
@@ -517,12 +513,11 @@ s_uFillDataHead(
byPktType, &buf->a);
/* Get Duration and TimeStampOff */
- buf->duration = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
- buf->duration_f0 = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
- buf->duration_f1 = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
+ buf->duration = getDurationTimeStamp(DATADUR_A, byPktType, wCurrentRate);
+ buf->duration_f0 = getDurationTimeStamp(DATADUR_A_F0, byPktType,
+ wCurrentRate);
+ buf->duration_f1 = getDurationTimeStamp(DATADUR_A_F1, byPktType,
+ wCurrentRate);
buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate);
return buf->duration;
}
@@ -537,11 +532,7 @@ s_uFillDataHead(
buf->duration = dur;
} else {
/* Get Duration and TimeStampOff */
- buf->duration =
- cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx,
- cbLastFragmentSize, uMACfragNum,
- byFBOption));
+ buf->duration = getDurationTimeStamp(DATADUR_A, byPktType, wCurrentRate);
}
buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate);
@@ -558,11 +549,7 @@ s_uFillDataHead(
buf->duration = dur;
} else {
/* Get Duration and TimeStampOff */
- buf->duration =
- cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx,
- cbLastFragmentSize, uMACfragNum,
- byFBOption));
+ buf->duration = getDurationTimeStamp(DATADUR_B, byPktType, wCurrentRate);
}
buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate);
--
2.7.4
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#198): https://lists.elisa.tech/g/linux-safety/message/198
Mute This Topic: https://lists.elisa.tech/mt/78474577/5278000
Group Owner: linux-safety+owner@lists.elisa.tech
Unsubscribe: https://lists.elisa.tech/g/linux-safety/unsub [linux-safety@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2020-11-24 10:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-24 10:48 [linux-safety] [PATCH v2 1/2] staging: vt6655: Fix alignment in device_main.c Milan Lakhani
2020-11-24 10:48 ` Milan Lakhani [this message]
2020-11-24 14:52 ` [linux-safety] [PATCH v2 2/2] staging: vt6655: Use macro in rxtx.c Lukas Bulwahn
2020-11-24 16:37 [linux-safety] [PATCH v2 1/2] staging: vt6655: Fix alignment in device_main.c Milan Lakhani
2020-11-24 16:37 ` [linux-safety] [PATCH v2 2/2] staging: vt6655: Use macro in rxtx.c Milan Lakhani
2020-11-24 17:01 [linux-safety] [PATCH v2 1/2] staging: vt6655: Fix alignment in device_main.c Milan Lakhani
2020-11-24 17:01 ` [linux-safety] [PATCH v2 2/2] staging: vt6655: Use macro in rxtx.c Milan Lakhani
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=1606214936-35192-2-git-send-email-milan.lakhani@codethink.co.uk \
--to=milan.lakhani@codethink.co.uk \
--cc=forest@alittletooquiet.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-safety@lists.elisa.tech \
--cc=lukas.bulwahn@gmail.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;
as well as URLs for NNTP newsgroup(s).