[PATCH] Staging: ks7010: Add required and preferred spaces around operators

From: Shiva Kerdel
Date: Thu Feb 16 2017 - 11:14:25 EST


Spaces should be added around operators to improve readability
and are required in some cases.

Signed-off-by: Shiva Kerdel <shiva@xxxxxxxx>
---
drivers/staging/ks7010/ks_hostif.c | 2 +-
drivers/staging/ks7010/ks_hostif.h | 64 +++++++++++++++++-----------------
drivers/staging/ks7010/ks_wlan.h | 4 +--
drivers/staging/ks7010/ks_wlan_ioctl.h | 64 +++++++++++++++++-----------------
drivers/staging/ks7010/ks_wlan_net.c | 4 +--
drivers/staging/ks7010/michael_mic.c | 8 ++---
6 files changed, 73 insertions(+), 73 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
index 4f430a0c845b..97d7b56c592a 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -1101,7 +1101,7 @@ void hostif_event_check(struct ks_wlan_private *priv)
priv->hostt.qtail = (priv->hostt.qtail + 1) % SME_EVENT_BUFF_SIZE;
}

-#define CHECK_ALINE(size) (size%4 ? (size+(4-(size%4))):size)
+#define CHECK_ALINE(size) (size % 4 ? (size + (4 - (size % 4))) : size)

int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *packet)
{
diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h
index 743f31ead56e..30c49b699d62 100644
--- a/drivers/staging/ks7010/ks_hostif.h
+++ b/drivers/staging/ks7010/ks_hostif.h
@@ -553,34 +553,34 @@ struct hostif_mic_failure_confirm_t {
#define TX_RATE_FIXED 5

/* 11b rate */
-#define TX_RATE_1M (uint8_t)(10/5) /* 11b 11g basic rate */
-#define TX_RATE_2M (uint8_t)(20/5) /* 11b 11g basic rate */
-#define TX_RATE_5M (uint8_t)(55/5) /* 11g basic rate */
-#define TX_RATE_11M (uint8_t)(110/5) /* 11g basic rate */
+#define TX_RATE_1M (uint8_t)(10 / 5) /* 11b 11g basic rate */
+#define TX_RATE_2M (uint8_t)(20 / 5) /* 11b 11g basic rate */
+#define TX_RATE_5M (uint8_t)(55 / 5) /* 11g basic rate */
+#define TX_RATE_11M (uint8_t)(110 / 5) /* 11g basic rate */

/* 11g rate */
-#define TX_RATE_6M (uint8_t)(60/5) /* 11g basic rate */
-#define TX_RATE_12M (uint8_t)(120/5) /* 11g basic rate */
-#define TX_RATE_24M (uint8_t)(240/5) /* 11g basic rate */
-#define TX_RATE_9M (uint8_t)(90/5)
-#define TX_RATE_18M (uint8_t)(180/5)
-#define TX_RATE_36M (uint8_t)(360/5)
-#define TX_RATE_48M (uint8_t)(480/5)
-#define TX_RATE_54M (uint8_t)(540/5)
+#define TX_RATE_6M (uint8_t)(60 / 5) /* 11g basic rate */
+#define TX_RATE_12M (uint8_t)(120 / 5) /* 11g basic rate */
+#define TX_RATE_24M (uint8_t)(240 / 5) /* 11g basic rate */
+#define TX_RATE_9M (uint8_t)(90 / 5)
+#define TX_RATE_18M (uint8_t)(180 / 5)
+#define TX_RATE_36M (uint8_t)(360 / 5)
+#define TX_RATE_48M (uint8_t)(480 / 5)
+#define TX_RATE_54M (uint8_t)(540 / 5)

-#define IS_11B_RATE(A) (((A&RATE_MASK)==TX_RATE_1M)||((A&RATE_MASK)==TX_RATE_2M)||\
- ((A&RATE_MASK)==TX_RATE_5M)||((A&RATE_MASK)==TX_RATE_11M))
+#define IS_11B_RATE(A) (((A & RATE_MASK) == TX_RATE_1M ) || ((A & RATE_MASK) == TX_RATE_2M) || \
+ ((A & RATE_MASK) == TX_RATE_5M) || ((A & RATE_MASK) == TX_RATE_11M))

-#define IS_OFDM_RATE(A) (((A&RATE_MASK)==TX_RATE_6M)||((A&RATE_MASK)==TX_RATE_12M)||\
- ((A&RATE_MASK)==TX_RATE_24M)||((A&RATE_MASK)==TX_RATE_9M)||\
- ((A&RATE_MASK)==TX_RATE_18M)||((A&RATE_MASK)==TX_RATE_36M)||\
- ((A&RATE_MASK)==TX_RATE_48M)||((A&RATE_MASK)==TX_RATE_54M))
+#define IS_OFDM_RATE(A) (((A & RATE_MASK) == TX_RATE_6M) || ((A & RATE_MASK) == TX_RATE_12M) || \
+ ((A & RATE_MASK) == TX_RATE_24M) || ((A & RATE_MASK) == TX_RATE_9M) || \
+ ((A & RATE_MASK) == TX_RATE_18M) || ((A & RATE_MASK) == TX_RATE_36M) || \
+ ((A & RATE_MASK) == TX_RATE_48M) || ((A & RATE_MASK) == TX_RATE_54M))

-#define IS_11BG_RATE(A) (IS_11B_RATE(A)||IS_OFDM_RATE(A))
+#define IS_11BG_RATE(A) (IS_11B_RATE(A) || IS_OFDM_RATE(A))

-#define IS_OFDM_EXT_RATE(A) (((A&RATE_MASK)==TX_RATE_9M)||((A&RATE_MASK)==TX_RATE_18M)||\
- ((A&RATE_MASK)==TX_RATE_36M)||((A&RATE_MASK)==TX_RATE_48M)||\
- ((A&RATE_MASK)==TX_RATE_54M))
+#define IS_OFDM_EXT_RATE(A) (((A & RATE_MASK) == TX_RATE_9M) || ((A & RATE_MASK) == TX_RATE_18M) || \
+ ((A & RATE_MASK) == TX_RATE_36M) || ((A & RATE_MASK) == TX_RATE_48M) || \
+ ((A & RATE_MASK) == TX_RATE_54M))

enum {
CONNECT_STATUS = 0,
@@ -602,16 +602,16 @@ enum {

/* macro function */
#define HIF_EVENT_MASK 0xE800
-#define IS_HIF_IND(_EVENT) ((_EVENT&HIF_EVENT_MASK)==0xE800 && \
- ((_EVENT&~HIF_EVENT_MASK)==0x0001 || \
- (_EVENT&~HIF_EVENT_MASK)==0x0006 || \
- (_EVENT&~HIF_EVENT_MASK)==0x000C || \
- (_EVENT&~HIF_EVENT_MASK)==0x0011 || \
- (_EVENT&~HIF_EVENT_MASK)==0x0012))
-
-#define IS_HIF_CONF(_EVENT) ((_EVENT&HIF_EVENT_MASK)==0xE800 && \
- (_EVENT&~HIF_EVENT_MASK)>0x0000 && \
- (_EVENT&~HIF_EVENT_MASK)<0x0012 && \
+#define IS_HIF_IND(_EVENT) ((_EVENT & HIF_EVENT_MASK) == 0xE800 && \
+ ((_EVENT & ~HIF_EVENT_MASK) == 0x0001 || \
+ (_EVENT & ~HIF_EVENT_MASK) == 0x0006 || \
+ (_EVENT & ~HIF_EVENT_MASK) == 0x000C || \
+ (_EVENT & ~HIF_EVENT_MASK) == 0x0011 || \
+ (_EVENT & ~HIF_EVENT_MASK) == 0x0012))
+
+#define IS_HIF_CONF(_EVENT) ((_EVENT & HIF_EVENT_MASK) == 0xE800 && \
+ (_EVENT & ~HIF_EVENT_MASK) > 0x0000 && \
+ (_EVENT & ~HIF_EVENT_MASK) < 0x0012 && \
!IS_HIF_IND(_EVENT) )

#ifdef __KERNEL__
diff --git a/drivers/staging/ks7010/ks_wlan.h b/drivers/staging/ks7010/ks_wlan.h
index c7fa508bffe4..350622673ff9 100644
--- a/drivers/staging/ks7010/ks_wlan.h
+++ b/drivers/staging/ks7010/ks_wlan.h
@@ -36,7 +36,7 @@

#ifdef KS_WLAN_DEBUG
#define DPRINTK(n, fmt, args...) \
- if (KS_WLAN_DEBUG>(n)) printk(KERN_NOTICE "%s: "fmt, __FUNCTION__, ## args)
+ if (KS_WLAN_DEBUG > (n)) printk(KERN_NOTICE "%s: "fmt, __FUNCTION__, ## args)
#else
#define DPRINTK(n, fmt, args...)
#endif
@@ -94,7 +94,7 @@ enum {
#define SME_WEP_VAL2 (1<<6)
#define SME_WEP_VAL3 (1<<7)
#define SME_WEP_VAL4 (1<<8)
-#define SME_WEP_VAL_MASK (SME_WEP_VAL1|SME_WEP_VAL2|SME_WEP_VAL3|SME_WEP_VAL4)
+#define SME_WEP_VAL_MASK (SME_WEP_VAL1 | SME_WEP_VAL2 | SME_WEP_VAL3 | SME_WEP_VAL4)
#define SME_RSN (1<<9)
#define SME_RSN_MULTICAST (1<<10)
#define SME_RSN_UNICAST (1<<11)
diff --git a/drivers/staging/ks7010/ks_wlan_ioctl.h b/drivers/staging/ks7010/ks_wlan_ioctl.h
index 84554b6bb239..8e62b10effd6 100644
--- a/drivers/staging/ks7010/ks_wlan_ioctl.h
+++ b/drivers/staging/ks7010/ks_wlan_ioctl.h
@@ -15,43 +15,43 @@
#include <linux/wireless.h>
/* The low order bit identify a SET (0) or a GET (1) ioctl. */

-/* SIOCIWFIRSTPRIV+0 */
-/* former KS_WLAN_GET_DRIVER_VERSION SIOCIWFIRSTPRIV+1 */
-/* SIOCIWFIRSTPRIV+2 */
-#define KS_WLAN_GET_FIRM_VERSION SIOCIWFIRSTPRIV+3
+/* SIOCIWFIRSTPRIV + 0 */
+/* former KS_WLAN_GET_DRIVER_VERSION SIOCIWFIRSTPRIV + 1 */
+/* SIOCIWFIRSTPRIV + 2 */
+#define KS_WLAN_GET_FIRM_VERSION SIOCIWFIRSTPRIV + 3
#ifdef WPS
-#define KS_WLAN_SET_WPS_ENABLE SIOCIWFIRSTPRIV+4
-#define KS_WLAN_GET_WPS_ENABLE SIOCIWFIRSTPRIV+5
-#define KS_WLAN_SET_WPS_PROBE_REQ SIOCIWFIRSTPRIV+6
+#define KS_WLAN_SET_WPS_ENABLE SIOCIWFIRSTPRIV + 4
+#define KS_WLAN_GET_WPS_ENABLE SIOCIWFIRSTPRIV + 5
+#define KS_WLAN_SET_WPS_PROBE_REQ SIOCIWFIRSTPRIV + 6
#endif
-#define KS_WLAN_GET_EEPROM_CKSUM SIOCIWFIRSTPRIV+7
-#define KS_WLAN_SET_PREAMBLE SIOCIWFIRSTPRIV+8
-#define KS_WLAN_GET_PREAMBLE SIOCIWFIRSTPRIV+9
-#define KS_WLAN_SET_POWER_SAVE SIOCIWFIRSTPRIV+10
-#define KS_WLAN_GET_POWER_SAVE SIOCIWFIRSTPRIV+11
-#define KS_WLAN_SET_SCAN_TYPE SIOCIWFIRSTPRIV+12
-#define KS_WLAN_GET_SCAN_TYPE SIOCIWFIRSTPRIV+13
-#define KS_WLAN_SET_RX_GAIN SIOCIWFIRSTPRIV+14
-#define KS_WLAN_GET_RX_GAIN SIOCIWFIRSTPRIV+15
-#define KS_WLAN_HOSTT SIOCIWFIRSTPRIV+16 /* unused */
-//#define KS_WLAN_SET_REGION SIOCIWFIRSTPRIV+17
-#define KS_WLAN_SET_BEACON_LOST SIOCIWFIRSTPRIV+18
-#define KS_WLAN_GET_BEACON_LOST SIOCIWFIRSTPRIV+19
+#define KS_WLAN_GET_EEPROM_CKSUM SIOCIWFIRSTPRIV + 7
+#define KS_WLAN_SET_PREAMBLE SIOCIWFIRSTPRIV + 8
+#define KS_WLAN_GET_PREAMBLE SIOCIWFIRSTPRIV + 9
+#define KS_WLAN_SET_POWER_SAVE SIOCIWFIRSTPRIV + 10
+#define KS_WLAN_GET_POWER_SAVE SIOCIWFIRSTPRIV + 11
+#define KS_WLAN_SET_SCAN_TYPE SIOCIWFIRSTPRIV + 12
+#define KS_WLAN_GET_SCAN_TYPE SIOCIWFIRSTPRIV + 13
+#define KS_WLAN_SET_RX_GAIN SIOCIWFIRSTPRIV + 14
+#define KS_WLAN_GET_RX_GAIN SIOCIWFIRSTPRIV + 15
+#define KS_WLAN_HOSTT SIOCIWFIRSTPRIV + 16 /* unused */
+//#define KS_WLAN_SET_REGION SIOCIWFIRSTPRIV + 17
+#define KS_WLAN_SET_BEACON_LOST SIOCIWFIRSTPRIV + 18
+#define KS_WLAN_GET_BEACON_LOST SIOCIWFIRSTPRIV + 19

-#define KS_WLAN_SET_TX_GAIN SIOCIWFIRSTPRIV+20
-#define KS_WLAN_GET_TX_GAIN SIOCIWFIRSTPRIV+21
+#define KS_WLAN_SET_TX_GAIN SIOCIWFIRSTPRIV + 20
+#define KS_WLAN_GET_TX_GAIN SIOCIWFIRSTPRIV + 21

/* for KS7010 */
-#define KS_WLAN_SET_PHY_TYPE SIOCIWFIRSTPRIV+22
-#define KS_WLAN_GET_PHY_TYPE SIOCIWFIRSTPRIV+23
-#define KS_WLAN_SET_CTS_MODE SIOCIWFIRSTPRIV+24
-#define KS_WLAN_GET_CTS_MODE SIOCIWFIRSTPRIV+25
-/* SIOCIWFIRSTPRIV+26 */
-/* SIOCIWFIRSTPRIV+27 */
-#define KS_WLAN_SET_SLEEP_MODE SIOCIWFIRSTPRIV+28 /* sleep mode */
-#define KS_WLAN_GET_SLEEP_MODE SIOCIWFIRSTPRIV+29 /* sleep mode */
-/* SIOCIWFIRSTPRIV+30 */
-/* SIOCIWFIRSTPRIV+31 */
+#define KS_WLAN_SET_PHY_TYPE SIOCIWFIRSTPRIV + 22
+#define KS_WLAN_GET_PHY_TYPE SIOCIWFIRSTPRIV + 23
+#define KS_WLAN_SET_CTS_MODE SIOCIWFIRSTPRIV + 24
+#define KS_WLAN_GET_CTS_MODE SIOCIWFIRSTPRIV + 25
+/* SIOCIWFIRSTPRIV + 26 */
+/* SIOCIWFIRSTPRIV + 27 */
+#define KS_WLAN_SET_SLEEP_MODE SIOCIWFIRSTPRIV + 28 /* sleep mode */
+#define KS_WLAN_GET_SLEEP_MODE SIOCIWFIRSTPRIV + 29 /* sleep mode */
+/* SIOCIWFIRSTPRIV + 30 */
+/* SIOCIWFIRSTPRIV + 31 */

#ifdef __KERNEL__

diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index c7503a9306cd..abc644178fa2 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -2453,7 +2453,7 @@ static int ks_wlan_data_read(struct net_device *dev,
#if 0
/*------------------------------------------------------------------*/
/* Private handler : get wep string */
-#define WEP_ASCII_BUFF_SIZE (17+64*4+1)
+#define WEP_ASCII_BUFF_SIZE (17 + 64 * 4 + 1)
static int ks_wlan_get_wep_ascii(struct net_device *dev,
struct iw_request_info *info,
struct iw_point *dwrq, char *extra)
@@ -3394,7 +3394,7 @@ int ks_wlan_close(struct net_device *dev)

/* Operational parameters that usually are not changed. */
/* Time in jiffies before concluding the transmitter is hung. */
-#define TX_TIMEOUT (3*HZ)
+#define TX_TIMEOUT (3 * HZ)
static const unsigned char dummy_addr[] = {
0x00, 0x0b, 0xe3, 0x00, 0x00, 0x00
};
diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c
index 2f535c08e172..f6e70fa2a12f 100644
--- a/drivers/staging/ks7010/michael_mic.c
+++ b/drivers/staging/ks7010/michael_mic.c
@@ -14,11 +14,11 @@
#include "michael_mic.h"

// Rotation functions on 32 bit values
-#define ROL32(A, n) (((A) << (n)) | (((A)>>(32-(n))) & ((1UL << (n)) - 1)))
-#define ROR32(A, n) ROL32((A), 32-(n))
+#define ROL32(A, n) (((A) << (n)) | (((A) >> (32 - (n))) & ((1UL << (n)) - 1)))
+#define ROR32(A, n) ROL32((A), 32 - (n))
// Convert from Byte[] to UInt32 in a portable way
-#define getUInt32(A, B) ((uint32_t)(A[B+0] << 0) \
- + (A[B+1] << 8) + (A[B+2] << 16) + (A[B+3] << 24))
+#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) \
--
2.11.1