Re: [PATCH] Staging: ks7010: Fix tabs in ks_hostif.h.
From: Joe Perches
Date: Wed Feb 01 2017 - 16:48:41 EST
On Wed, 2017-02-01 at 12:59 -0800, Logan Gorence wrote:
> Convert spaces to tabs in ks_hostif.h, according to
> the checkpatch.pl script.
[]
> diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h
[]
> @@ -569,18 +569,18 @@ struct hostif_mic_failure_confirm_t {
> #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))
> + ((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))
> + ((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_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))
> + ((A&RATE_MASK)==TX_RATE_36M)||((A&RATE_MASK)==TX_RATE_48M)||\
> + ((A&RATE_MASK)==TX_RATE_54M))
Rather than just quieting checkpatch messages,
please try to make the code more intelligible
for humans to read.
Doing something like the below is clearer and
can actually produce smaller object code too.
---
diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h
index 743f31ead56e..755e53805102 100644
--- a/drivers/staging/ks7010/ks_hostif.h
+++ b/drivers/staging/ks7010/ks_hostif.h
@@ -568,19 +568,31 @@ struct hostif_mic_failure_confirm_t {
#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_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_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_11B_RATE(A) \
+({ \
+ typeof(A) _r = (A) & RATE_MASK; \
+ (_r == TX_RATE_1M || _r == TX_RATE_2M || \
+ _r == TX_RATE_5M || _r == TX_RATE_11M); \
+})
+
+#define IS_OFDM_RATE(A) \
+({ \
+ typeof(A) _r = (A) & RATE_MASK; \
+ (_r == TX_RATE_6M || _r == TX_RATE_12M || \
+ _r == TX_RATE_24M || _r == TX_RATE_9M || \
+ _r == TX_RATE_18M || _r == TX_RATE_36M || \
+ _r == TX_RATE_48M || _r == TX_RATE_54M); \
+})
+
+#define IS_11BG_RATE(A) (IS_11B_RATE(A) || IS_OFDM_RATE(A))
+
+#define IS_OFDM_EXT_RATE(A) \
+({ \
+ typeof(A) _r = (A) & RATE_MASK; \
+ (_r == TX_RATE_9M || _r == TX_RATE_18M || \
+ _r == TX_RATE_36M || _r == TX_RATE_48M || \
+ _r == TX_RATE_54M); \
+})
enum {
CONNECT_STATUS = 0,