[PATCH] Staging: ks7010: michael_mic: fixed macros coding style issue

2016-07-18 Thread 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 
---
 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

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: rtl8723au: os_intfs: fixed case statement is variable issue

2016-08-11 Thread Bing Sun
Fixed sparse parse error:
Expected constant expression in case statement.

Signed-off-by: Bing Sun 
---
 drivers/staging/rtl8723au/os_dep/os_intfs.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723au/os_dep/os_intfs.c 
b/drivers/staging/rtl8723au/os_dep/os_intfs.c
index b8848c2..f30d5d2 100644
--- a/drivers/staging/rtl8723au/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8723au/os_dep/os_intfs.c
@@ -283,14 +283,13 @@ static u32 rtw_classify8021d(struct sk_buff *skb)
 */
if (skb->priority >= 256 && skb->priority <= 263)
return skb->priority - 256;
-   switch (skb->protocol) {
-   case htons(ETH_P_IP):
+
+   if (skb->protocol == htons(ETH_P_IP)) {
dscp = ip_hdr(skb)->tos & 0xfc;
-   break;
-   default:
-   return 0;
+   return dscp >> 5;
}
-   return dscp >> 5;
+
+   return 0;
 }
 
 static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb,
-- 
2.1.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel