From 6bef3f01398dc12532873f8b2376dba1339908bb Mon Sep 17 00:00:00 2001 From: Bing Sun Date: Tue, 19 Jul 2016 09:51:06 +0800 Subject: Staging: ks7010: michael_mic: fixed macros coding style issue 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 Reviewed-by: Wolfram Sang Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ks7010/michael_mic.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'drivers/staging/ks7010/michael_mic.c') diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c index e14c109b3cab..d332678781d2 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) -- cgit v1.2.3 From 7e935f181c00f779b3112ae57f423b3d3428e94a Mon Sep 17 00:00:00 2001 From: Sandhya Bankar Date: Tue, 20 Sep 2016 13:11:39 +0530 Subject: Staging: ks7010: michael_mic: Use "foo *bar" instead of "foo * bar". This issue was found by checkpatch. Signed-off-by: Sandhya Bankar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ks7010/michael_mic.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging/ks7010/michael_mic.c') diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c index d332678781d2..78ae2b8fb7f3 100644 --- a/drivers/staging/ks7010/michael_mic.c +++ b/drivers/staging/ks7010/michael_mic.c @@ -37,7 +37,7 @@ do { \ } while (0) static -void MichaelInitializeFunction(struct michel_mic_t *Mic, uint8_t * key) +void MichaelInitializeFunction(struct michel_mic_t *Mic, uint8_t *key) { // Set the key Mic->K0 = getUInt32(key, 0); @@ -60,7 +60,7 @@ do{ \ }while(0) static -void MichaelAppend(struct michel_mic_t *Mic, uint8_t * src, int nBytes) +void MichaelAppend(struct michel_mic_t *Mic, uint8_t *src, int nBytes) { int addlen; if (Mic->nBytesInM) { @@ -94,7 +94,7 @@ void MichaelAppend(struct michel_mic_t *Mic, uint8_t * src, int nBytes) } static -void MichaelGetMIC(struct michel_mic_t *Mic, uint8_t * dst) +void MichaelGetMIC(struct michel_mic_t *Mic, uint8_t *dst) { uint8_t *data = Mic->M; switch (Mic->nBytesInM) { @@ -122,9 +122,9 @@ void MichaelGetMIC(struct michel_mic_t *Mic, uint8_t * dst) MichaelClear(Mic); } -void MichaelMICFunction(struct michel_mic_t *Mic, uint8_t * Key, - uint8_t * Data, int Len, uint8_t priority, - uint8_t * Result) +void MichaelMICFunction(struct michel_mic_t *Mic, uint8_t *Key, + uint8_t *Data, int Len, uint8_t priority, + uint8_t *Result) { uint8_t pad_data[4] = { priority, 0, 0, 0 }; // Compute the MIC value -- cgit v1.2.3