Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1443298

[PATCH] Enclose multiple statements macros in a do while loop

From Sunbing <sunbing@redflag-linux.com>
Newsgroups linux.kernel
Subject [PATCH] Enclose multiple statements macros in a do while loop
Date 2016-07-14 11:10 +0200
Message-ID <rUKOB-7Jy-1@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


The formatting of macros definetion in ks7010/michael_mic.c is not
consistent with the general kernel coding style.

Fix it by the result of scripts/checkpatch.pl.

No functional changes.

Signed-off-by: Sunbing <sunbing.linux@gmail.com>
---
 drivers/staging/ks7010/michael_mic.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c
index e14c109..ad4f779 100644
--- a/drivers/staging/ks7010/michael_mic.c
+++ b/drivers/staging/ks7010/michael_mic.c
@@ -20,15 +20,21 @@
 #define getUInt32( A, B ) 	(uint32_t)(A[B+0] << 0) + (A[B+1] << 8) + (A[B+2] << 16) + (A[B+3] << 24)
 
 // Convert from UInt32 to Byte[] in a portable way
-#define putUInt32( A, B, C ) 	A[B+0] = (uint8_t) (C & 0xff);		\
-				A[B+1] = (uint8_t) ((C>>8) & 0xff);	\
-				A[B+2] = (uint8_t) ((C>>16) & 0xff);	\
-				A[B+3] = (uint8_t) ((C>>24) & 0xff)
+#define putUInt32(A, B, C)					\
+do {								\
+	A[B+0] = (uint8_t) (C & 0xff);				\
+	A[B+1] = (uint8_t) ((C>>8) & 0xff);			\
+	A[B+2] = (uint8_t) ((C>>16) & 0xff);			\
+	A[B+3] = (uint8_t) ((C>>24) & 0xff);			\
+} while (0)
 
 // Reset the state to the empty message.
-#define MichaelClear( A ) 	A->L = A->K0; \
-				A->R = A->K1; \
-				A->nBytesInM = 0;
+#define MichaelClear(A)			\
+do {					\
+	A->L = A->K0;			\
+	A->R = A->K1;			\
+	A->nBytesInM = 0;		\
+} while (0)
 
 static
 void MichaelInitializeFunction(struct michel_mic_t *Mic, uint8_t * key)
-- 
2.1.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] Enclose multiple statements macros in a do while loop Sunbing <sunbing@redflag-linux.com> - 2016-07-14 11:10 +0200
  Re: [PATCH] Enclose multiple statements macros in a do while loop Greg KH <gregkh@linuxfoundation.org> - 2016-07-15 02:40 +0200
    Re: [PATCH] Enclose multiple statements macros in a do while loop sunbing <sunbing@redflag-linux.com> - 2016-07-17 18:20 +0200

csiph-web