[PATCH v5 02/15] staging: rtl8723au: Fix "before/around/after" whitespace issues

2015-03-28 Thread M. Vefa Bicakci
Correct a number of "space(s) required before/around/after" checkpatch.pl
issues in a number of functions in rtl8723au's rtw_security.c.

Signed-off-by: M. Vefa Bicakci 

---

v5: Correct even more whitespace issues.

v2: Correct one more whitespace issue ("length-4") in
rtw_tkip_decrypt23a.
---
 drivers/staging/rtl8723au/core/rtw_security.c | 219 +-
 1 file changed, 113 insertions(+), 106 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_security.c 
b/drivers/staging/rtl8723au/core/rtw_security.c
index 92882f60bc0e..572fcf3f936d 100644
--- a/drivers/staging/rtl8723au/core/rtw_security.c
+++ b/drivers/staging/rtl8723au/core/rtw_security.c
@@ -129,14 +129,14 @@ static void crc32_init(void)
 static u32 getcrc32(u8 *buf, int len)
 {
u8 *p;
-   u32  crc;
+   u32 crc;
 
if (bcrc32initialized == 0) crc32_init();
 
crc = 0x;   /* preload shift register, per CRC-32 spec */
 
for (p = buf; len > 0; ++p, --len)
-   crc = crc32_table[ (crc ^ *p) & 0xff] ^ (crc >> 8);
+   crc = crc32_table[(crc ^ *p) & 0xff] ^ (crc >> 8);
 
return ~crc;/* transmit complement, per CRC-32 spec */
 }
@@ -182,7 +182,7 @@ void rtw_wep_encrypt23a(struct rtw_adapter *padapter,
if ((curfragnum + 1) == pattrib->nr_frags) {
/* the last fragment */
length = pattrib->last_txcmdsz - pattrib->hdrlen -
-   pattrib->iv_len- pattrib->icv_len;
+   pattrib->iv_len - pattrib->icv_len;
 
*((u32 *)crc) = cpu_to_le32(getcrc32(payload, length));
 
@@ -262,8 +262,8 @@ static u32 secmicgetuint32(u8 *p)
s32 i;
u32 res = 0;
 
-   for (i = 0; i<4; i++) {
-   res |= ((u32)(*p++)) << (8*i);
+   for (i = 0; i < 4; i++) {
+   res |= ((u32)(*p++)) << (8 * i);
}
 
return res;
@@ -274,7 +274,7 @@ static void secmicputuint32(u8 *p, u32 val)
 {
long i;
 
-   for (i = 0; i<4; i++) {
+   for (i = 0; i < 4; i++) {
*p++ = (u8) (val & 0xff);
val >>= 8;
}
@@ -307,7 +307,7 @@ void rtw_secmicappend23abyte23a(struct mic_data *pmicdata, 
u8 b)
 {
 
/*  Append the byte to our word-sized buffer */
-   pmicdata->M |= ((unsigned long)b) << (8*pmicdata->nBytesInM);
+   pmicdata->M |= ((unsigned long)b) << (8 * pmicdata->nBytesInM);
pmicdata->nBytesInM++;
/*  Process the word if it is full. */
if (pmicdata->nBytesInM >= 4) {
@@ -331,7 +331,7 @@ void rtw_secmicappend23a(struct mic_data *pmicdata, u8 
*src, u32 nbytes)
 {
 
/*  This is simple */
-   while(nbytes > 0) {
+   while (nbytes > 0) {
rtw_secmicappend23abyte23a(pmicdata, *src++);
nbytes--;
}
@@ -348,12 +348,12 @@ void rtw_secgetmic23a(struct mic_data *pmicdata, u8 *dst)
rtw_secmicappend23abyte23a(pmicdata, 0);
rtw_secmicappend23abyte23a(pmicdata, 0);
/*  and then zeroes until the length is a multiple of 4 */
-   while(pmicdata->nBytesInM != 0) {
+   while (pmicdata->nBytesInM != 0) {
rtw_secmicappend23abyte23a(pmicdata, 0);
}
/*  The appendByte function has already computed the result. */
secmicputuint32(dst, pmicdata->L);
-   secmicputuint32(dst+4, pmicdata->R);
+   secmicputuint32(dst + 4, pmicdata->R);
/*  Reset to the empty message. */
secmicclear(pmicdata);
 
@@ -364,10 +364,10 @@ void rtw_seccalctkipmic23a(u8 *key, u8 *header, u8 *data, 
u32 data_len,
 {
 
struct mic_data micdata;
-   u8 priority[4]={0x0, 0x0, 0x0, 0x0};
+   u8 priority[4] = {0x0, 0x0, 0x0, 0x0};
 
rtw_secmicsetkey23a(, key);
-   priority[0]= pri;
+   priority[0] = pri;
 
/* Michael MIC pseudo header: DA, SA, 3 x 0, Priority */
if (header[1]&1) {   /* ToDS == 1 */
@@ -398,11 +398,11 @@ void rtw_seccalctkipmic23a(u8 *key, u8 *header, u8 *data, 
u32 data_len,
 #define   Lo8(v16)   ((u8)((v16)   & 0x00FF))
 #define   Hi8(v16)   ((u8)(((v16) >> 8) & 0x00FF))
 #define  Lo16(v32)   ((u16)((v32)   & 0x))
-#define  Hi16(v32)   ((u16)(((v32) >>16) & 0x))
+#define  Hi16(v32)   ((u16)(((v32) >> 16) & 0x))
 #define  Mk16(hi, lo) ((lo) ^ (((u16)(hi)) << 8))
 
 /* select the Nth 16-bit word of the temporal key unsigned char array TK[]   */
-#define  TK16(N) Mk16(tk[2*(N)+1], tk[2*(N)])
+#define  TK16(N) Mk16(tk[2 * (N) + 1], tk[2 * (N)])
 
 /* S-box lookup: 16 bits --> 16 bits */
 #define _S_(v16) (Sbox1[0][Lo8(v16)] ^ Sbox1[1][Hi8(v16)])
@@ -415,7 +415,7 @@ void rtw_seccalctkipmic23a(u8 *key, u8 *header, u8 *data, 
u32 data_len,
 #define RC4_KEY_SIZE 16/* 128-bit RC4KEY (104 bits unknown) */
 
 /* 2-unsigned char by 2-unsigned char subset of the full AES S-box table */
-static const unsigned short 

[PATCH v5 02/15] staging: rtl8723au: Fix before/around/after whitespace issues

2015-03-28 Thread M. Vefa Bicakci
Correct a number of space(s) required before/around/after checkpatch.pl
issues in a number of functions in rtl8723au's rtw_security.c.

Signed-off-by: M. Vefa Bicakci m@runbox.com

---

v5: Correct even more whitespace issues.

v2: Correct one more whitespace issue (length-4) in
rtw_tkip_decrypt23a.
---
 drivers/staging/rtl8723au/core/rtw_security.c | 219 +-
 1 file changed, 113 insertions(+), 106 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_security.c 
b/drivers/staging/rtl8723au/core/rtw_security.c
index 92882f60bc0e..572fcf3f936d 100644
--- a/drivers/staging/rtl8723au/core/rtw_security.c
+++ b/drivers/staging/rtl8723au/core/rtw_security.c
@@ -129,14 +129,14 @@ static void crc32_init(void)
 static u32 getcrc32(u8 *buf, int len)
 {
u8 *p;
-   u32  crc;
+   u32 crc;
 
if (bcrc32initialized == 0) crc32_init();
 
crc = 0x;   /* preload shift register, per CRC-32 spec */
 
for (p = buf; len  0; ++p, --len)
-   crc = crc32_table[ (crc ^ *p)  0xff] ^ (crc  8);
+   crc = crc32_table[(crc ^ *p)  0xff] ^ (crc  8);
 
return ~crc;/* transmit complement, per CRC-32 spec */
 }
@@ -182,7 +182,7 @@ void rtw_wep_encrypt23a(struct rtw_adapter *padapter,
if ((curfragnum + 1) == pattrib-nr_frags) {
/* the last fragment */
length = pattrib-last_txcmdsz - pattrib-hdrlen -
-   pattrib-iv_len- pattrib-icv_len;
+   pattrib-iv_len - pattrib-icv_len;
 
*((u32 *)crc) = cpu_to_le32(getcrc32(payload, length));
 
@@ -262,8 +262,8 @@ static u32 secmicgetuint32(u8 *p)
s32 i;
u32 res = 0;
 
-   for (i = 0; i4; i++) {
-   res |= ((u32)(*p++))  (8*i);
+   for (i = 0; i  4; i++) {
+   res |= ((u32)(*p++))  (8 * i);
}
 
return res;
@@ -274,7 +274,7 @@ static void secmicputuint32(u8 *p, u32 val)
 {
long i;
 
-   for (i = 0; i4; i++) {
+   for (i = 0; i  4; i++) {
*p++ = (u8) (val  0xff);
val = 8;
}
@@ -307,7 +307,7 @@ void rtw_secmicappend23abyte23a(struct mic_data *pmicdata, 
u8 b)
 {
 
/*  Append the byte to our word-sized buffer */
-   pmicdata-M |= ((unsigned long)b)  (8*pmicdata-nBytesInM);
+   pmicdata-M |= ((unsigned long)b)  (8 * pmicdata-nBytesInM);
pmicdata-nBytesInM++;
/*  Process the word if it is full. */
if (pmicdata-nBytesInM = 4) {
@@ -331,7 +331,7 @@ void rtw_secmicappend23a(struct mic_data *pmicdata, u8 
*src, u32 nbytes)
 {
 
/*  This is simple */
-   while(nbytes  0) {
+   while (nbytes  0) {
rtw_secmicappend23abyte23a(pmicdata, *src++);
nbytes--;
}
@@ -348,12 +348,12 @@ void rtw_secgetmic23a(struct mic_data *pmicdata, u8 *dst)
rtw_secmicappend23abyte23a(pmicdata, 0);
rtw_secmicappend23abyte23a(pmicdata, 0);
/*  and then zeroes until the length is a multiple of 4 */
-   while(pmicdata-nBytesInM != 0) {
+   while (pmicdata-nBytesInM != 0) {
rtw_secmicappend23abyte23a(pmicdata, 0);
}
/*  The appendByte function has already computed the result. */
secmicputuint32(dst, pmicdata-L);
-   secmicputuint32(dst+4, pmicdata-R);
+   secmicputuint32(dst + 4, pmicdata-R);
/*  Reset to the empty message. */
secmicclear(pmicdata);
 
@@ -364,10 +364,10 @@ void rtw_seccalctkipmic23a(u8 *key, u8 *header, u8 *data, 
u32 data_len,
 {
 
struct mic_data micdata;
-   u8 priority[4]={0x0, 0x0, 0x0, 0x0};
+   u8 priority[4] = {0x0, 0x0, 0x0, 0x0};
 
rtw_secmicsetkey23a(micdata, key);
-   priority[0]= pri;
+   priority[0] = pri;
 
/* Michael MIC pseudo header: DA, SA, 3 x 0, Priority */
if (header[1]1) {   /* ToDS == 1 */
@@ -398,11 +398,11 @@ void rtw_seccalctkipmic23a(u8 *key, u8 *header, u8 *data, 
u32 data_len,
 #define   Lo8(v16)   ((u8)((v16)0x00FF))
 #define   Hi8(v16)   ((u8)(((v16)  8)  0x00FF))
 #define  Lo16(v32)   ((u16)((v32)0x))
-#define  Hi16(v32)   ((u16)(((v32) 16)  0x))
+#define  Hi16(v32)   ((u16)(((v32)  16)  0x))
 #define  Mk16(hi, lo) ((lo) ^ (((u16)(hi))  8))
 
 /* select the Nth 16-bit word of the temporal key unsigned char array TK[]   */
-#define  TK16(N) Mk16(tk[2*(N)+1], tk[2*(N)])
+#define  TK16(N) Mk16(tk[2 * (N) + 1], tk[2 * (N)])
 
 /* S-box lookup: 16 bits -- 16 bits */
 #define _S_(v16) (Sbox1[0][Lo8(v16)] ^ Sbox1[1][Hi8(v16)])
@@ -415,7 +415,7 @@ void rtw_seccalctkipmic23a(u8 *key, u8 *header, u8 *data, 
u32 data_len,
 #define RC4_KEY_SIZE 16/* 128-bit RC4KEY (104 bits unknown) */
 
 /* 2-unsigned char by 2-unsigned char subset of the full AES S-box table */
-static const unsigned short Sbox1[2][256]=   /* Sbox for hash (can be in