aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorIvo van Doorn <IvDoorn@gmail.com>2008-06-06 16:58:29 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-06-14 12:17:57 -0400
commit4ae1168199021dacedacd32274eef402c5059841 (patch)
treee2d2d8da62ea85d56ced996792b5c20f8705cc8f /drivers
parenta26cbc650846b74dd7f46dd877fd30c472df14a1 (diff)
rt2x00: Use __builtin_choose_expr() instead of ?:
To really force the FIELD macros to determine the first bit of the register field we should use the __builtin_choose_expr() function. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-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