aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00reg.h22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00reg.h b/drivers/net/wireless/rt2x00/rt2x00reg.h
index c3f1202404d9..7e88ce5651b9 100644
--- a/drivers/net/wireless/rt2x00/rt2x00reg.h
+++ b/drivers/net/wireless/rt2x00/rt2x00reg.h
@@ -145,23 +145,27 @@ struct rt2x00_field32 {
145 * compile-time rather then run-time. 145 * compile-time rather then run-time.
146 */ 146 */
147#define compile_ffs2(__x) \ 147#define compile_ffs2(__x) \
148 ( ((__x) & 0x1) ? 0 : 1 ) 148 __builtin_choose_expr(((__x) & 0x1), 0, 1)
149 149
150#define compile_ffs4(__x) \ 150#define compile_ffs4(__x) \
151 ( ((__x) & 0x3) ? \ 151 __builtin_choose_expr(((__x) & 0x3), \
152 compile_ffs2(__x) : (compile_ffs2((__x) >> 2) + 2) ) 152 (compile_ffs2((__x))), \
153 (compile_ffs2((__x) >> 2) + 2))
153 154
154#define compile_ffs8(__x) \ 155#define compile_ffs8(__x) \
155 ( ((__x) & 0xf) ? \ 156 __builtin_choose_expr(((__x) & 0xf), \
156 compile_ffs4(__x) : (compile_ffs4((__x) >> 4) + 4) ) 157 (compile_ffs4((__x))), \
158 (compile_ffs4((__x) >> 4) + 4))
157 159
158#define compile_ffs16(__x) \ 160#define compile_ffs16(__x) \
159 ( ((__x) & 0xff) ? \ 161 __builtin_choose_expr(((__x) & 0xff), \
160 compile_ffs8(__x) : (compile_ffs8((__x) >> 8) + 8) ) 162 (compile_ffs8((__x))), \
163 (compile_ffs8((__x) >> 8) + 8))
161 164
162#define compile_ffs32(__x) \ 165#define compile_ffs32(__x) \
163 ( ((__x) & 0xffff) ? \ 166 __builtin_choose_expr(((__x) & 0xffff), \
164 compile_ffs16(__x) : (compile_ffs16((__x) >> 16) + 16) ) 167 (compile_ffs16((__x))), \
168 (compile_ffs16((__x) >> 16) + 16))
165 169
166/* 170/*
167 * This macro will check the requirements for the FIELD{8,16,32} macros 171 * This macro will check the requirements for the FIELD{8,16,32} macros