linux-safety.lists.elisa.tech archive mirror
 help / color / mirror / Atom feed
* [linux-safety] [PATCH v2 1/2] staging: vt6655: Fix alignment in device_main.c
@ 2020-11-24 17:01 Milan Lakhani
  2020-11-24 17:01 ` [linux-safety] [PATCH v2 2/2] staging: vt6655: Use macro in rxtx.c Milan Lakhani
  0 siblings, 1 reply; 5+ messages in thread
From: Milan Lakhani @ 2020-11-24 17:01 UTC (permalink / raw)
  To: devel, linux-kernel, linux-safety, gregkh; +Cc: Milan Lakhani

Correct alignment to open parenthesis in device_main.c. Reported by
checkpatch.

Signed-off-by: Milan Lakhani <milan.lakhani@codethink.co.uk>
---
 drivers/staging/vt6655/device_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index 9791654..0a39041 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -1077,7 +1077,7 @@ static void vnt_interrupt_process(struct vnt_private *priv)
 				PSbIsNextTBTTWakeUp((void *)priv);
 
 			if ((priv->op_mode == NL80211_IFTYPE_AP ||
-			    priv->op_mode == NL80211_IFTYPE_ADHOC) &&
+			     priv->op_mode == NL80211_IFTYPE_ADHOC) &&
 			    priv->vif->bss_conf.enable_beacon)
 				MACvOneShotTimer1MicroSec(priv,
 							  (priv->vif->bss_conf.beacon_int -
-- 
2.7.4



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#204): https://lists.elisa.tech/g/linux-safety/message/204
Mute This Topic: https://lists.elisa.tech/mt/78474578/5278000
Group Owner: linux-safety+owner@lists.elisa.tech
Unsubscribe: https://lists.elisa.tech/g/linux-safety/unsub [linux-safety@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [linux-safety] [PATCH v2 2/2] staging: vt6655: Use macro in rxtx.c
  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 ` Milan Lakhani
  0 siblings, 0 replies; 5+ messages in thread
From: Milan Lakhani @ 2020-11-24 17:01 UTC (permalink / raw)
  To: devel, linux-kernel, linux-safety, gregkh; +Cc: Milan Lakhani

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 ff45206..5ce0362 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 (#205): https://lists.elisa.tech/g/linux-safety/message/205
Mute This Topic: https://lists.elisa.tech/mt/78481482/5278000
Group Owner: linux-safety+owner@lists.elisa.tech
Unsubscribe: https://lists.elisa.tech/g/linux-safety/unsub [linux-safety@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [linux-safety] [PATCH v2 2/2] staging: vt6655: Use macro in rxtx.c
  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 ` Milan Lakhani
  0 siblings, 0 replies; 5+ messages in thread
From: Milan Lakhani @ 2020-11-24 16:37 UTC (permalink / raw)
  To: devel, linux-kernel, linux-safety; +Cc: Milan Lakhani

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 ff45206..5ce0362 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 (#203): https://lists.elisa.tech/g/linux-safety/message/203
Mute This Topic: https://lists.elisa.tech/mt/78480844/5278000
Group Owner: linux-safety+owner@lists.elisa.tech
Unsubscribe: https://lists.elisa.tech/g/linux-safety/unsub [linux-safety@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [linux-safety] [PATCH v2 2/2] staging: vt6655: Use macro in rxtx.c
  2020-11-24 10:48 ` [linux-safety] [PATCH v2 2/2] staging: vt6655: Use macro in rxtx.c Milan Lakhani
@ 2020-11-24 14:52   ` Lukas Bulwahn
  0 siblings, 0 replies; 5+ messages in thread
From: Lukas Bulwahn @ 2020-11-24 14:52 UTC (permalink / raw)
  To: Milan Lakhani
  Cc: Greg Kroah-Hartman, Linux Kernel Mailing List, linux-safety, forest

On Tue, Nov 24, 2020 at 11:49 AM Milan Lakhani
<milan.lakhani@codethink.co.uk> wrote:
>
> 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>

Patch looks good.

You need to CC:

devel@driverdev.osuosl.org


> ---
>  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 (#200): https://lists.elisa.tech/g/linux-safety/message/200
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]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [linux-safety] [PATCH v2 2/2] staging: vt6655: Use macro in rxtx.c
  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
  2020-11-24 14:52   ` Lukas Bulwahn
  0 siblings, 1 reply; 5+ messages in thread
From: Milan Lakhani @ 2020-11-24 10:48 UTC (permalink / raw)
  To: gregkh, lukas.bulwahn, linux-kernel, linux-safety, forest; +Cc: Milan Lakhani

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]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-11-24 17:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
  -- strict thread matches above, loose matches on Subject: below --
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 10:48 [linux-safety] [PATCH v2 1/2] staging: vt6655: Fix alignment in device_main.c Milan Lakhani
2020-11-24 10:48 ` [linux-safety] [PATCH v2 2/2] staging: vt6655: Use macro in rxtx.c Milan Lakhani
2020-11-24 14:52   ` Lukas Bulwahn

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).