All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: ks7010: michael_mic: fixed macros coding style issue
@ 2016-07-18  4:35 Sunbing
  2016-07-18 12:10 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Sunbing @ 2016-07-18  4:35 UTC (permalink / raw)
  To: gregkh; +Cc: wsa+renesas, devel, linux-kernel, sunbing.linux, Sunbing

Fixed coding style issue:
Enclose multiple statements macros definition in a do while loop.
Use one space around binary operators.

Signed-off-by: Sunbing <sunbing@redflag-linux.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..d332678 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

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

* Re: [PATCH] Staging: ks7010: michael_mic: fixed macros coding style issue
  2016-07-18  4:35 [PATCH] Staging: ks7010: michael_mic: fixed macros coding style issue Sunbing
@ 2016-07-18 12:10 ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2016-07-18 12:10 UTC (permalink / raw)
  To: Sunbing; +Cc: devel, wsa+renesas, sunbing.linux, linux-kernel

On Mon, Jul 18, 2016 at 12:35:44PM +0800, Sunbing wrote:
> Fixed coding style issue:
> Enclose multiple statements macros definition in a do while loop.
> Use one space around binary operators.
> 
> Signed-off-by: Sunbing <sunbing@redflag-linux.com>

Is that the legal name you use to sign documents?  If not, please resend
with the proper one in both the From: line, and signed-off-by: line.

thanks,

greg k-h

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

* Re: [PATCH] Staging: ks7010: michael_mic: fixed macros coding style issue
  2016-07-19  1:51 Bing Sun
  2016-07-20 16:02 ` Wolfram Sang
@ 2016-07-21 16:57 ` Wolfram Sang
  1 sibling, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2016-07-21 16:57 UTC (permalink / raw)
  To: Bing Sun; +Cc: gregkh, wsa+renesas, devel, linux-kernel, sunbing.linux

On Tue, Jul 19, 2016 at 09:51:06AM +0800, Bing Sun wrote:
> Fixed coding style issue:
> Enclose multiple statements macros definition in a do while loop.
> Use one space around binary operators.
> 
> Signed-off-by: Bing Sun <sunbing@redflag-linux.com>

Reviewed-by: Wolfram Sang <wsa@the-dreams.de>

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

* Re: [PATCH] Staging: ks7010: michael_mic: fixed macros coding style issue
  2016-07-19  1:51 Bing Sun
@ 2016-07-20 16:02 ` Wolfram Sang
  2016-07-21 16:57 ` Wolfram Sang
  1 sibling, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2016-07-20 16:02 UTC (permalink / raw)
  To: Bing Sun; +Cc: gregkh, wsa+renesas, devel, linux-kernel, sunbing.linux

[-- Attachment #1: Type: text/plain, Size: 1791 bytes --]

On Tue, Jul 19, 2016 at 09:51:06AM +0800, Bing Sun wrote:
> Fixed coding style issue:
> Enclose multiple statements macros definition in a do while loop.
> Use one space around binary operators.
> 
> Signed-off-by: Bing Sun <sunbing@redflag-linux.com>

Looks good for what it is. One comment below. I will test this tomorrow.

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

We surely have helper functions for this in the kernel?

>  
>  // 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
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* [PATCH] Staging: ks7010: michael_mic: fixed macros coding style issue
@ 2016-07-19  1:51 Bing Sun
  2016-07-20 16:02 ` Wolfram Sang
  2016-07-21 16:57 ` Wolfram Sang
  0 siblings, 2 replies; 5+ messages in thread
From: Bing Sun @ 2016-07-19  1:51 UTC (permalink / raw)
  To: gregkh; +Cc: wsa+renesas, devel, linux-kernel, sunbing.linux, Bing Sun

Fixed coding style issue:
Enclose multiple statements macros definition in a do while loop.
Use one space around binary operators.

Signed-off-by: Bing Sun <sunbing@redflag-linux.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..d332678 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

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

end of thread, other threads:[~2016-07-21 16:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-18  4:35 [PATCH] Staging: ks7010: michael_mic: fixed macros coding style issue Sunbing
2016-07-18 12:10 ` Greg KH
2016-07-19  1:51 Bing Sun
2016-07-20 16:02 ` Wolfram Sang
2016-07-21 16:57 ` Wolfram Sang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.