aboutsummaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorIvo van Doorn <IvDoorn@gmail.com>2008-06-06 22:58:29 +0200
committerJohn W. Linville <linville@tuxdriver.com>2008-06-14 12:17:57 -0400
commit4ae1168199021dacedacd32274eef402c5059841 (patch)
treee2d2d8da62ea85d56ced996792b5c20f8705cc8f /drivers/net
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/net')
-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 c3f1202404d..7e88ce5651b 100644
--- a/drivers/net/wireless/rt2x00/rt2x00reg.h
+++ b/drivers/net/wireless/rt2x00/rt2x00reg.h
@@ -145,23 +145,27 @@ struct rt2x00_field32 {
* compile-time rather then run-time.
*/
#define compile_ffs2(__x) \
- ( ((__x) & 0x1) ? 0 : 1 )
+ __builtin_choose_expr(((__x) & 0x1), 0, 1)
#define compile_ffs4(__x) \
- ( ((__x) & 0x3) ? \
- compile_ffs2(__x) : (compile_ffs2((__x) >> 2) + 2) )
+ __builtin_choose_expr(((__x) & 0x3), \
+ (compile_ffs2((__x))), \
+ (compile_ffs2((__x) >> 2) + 2))
#define compile_ffs8(__x) \
- ( ((__x) & 0xf) ? \
- compile_ffs4(__x) : (compile_ffs4((__x) >> 4) + 4) )
+ __builtin_choose_expr(((__x) & 0xf), \
+ (compile_ffs4((__x))), \
+ (compile_ffs4((__x) >> 4) + 4))
#define compile_ffs16(__x) \
- ( ((__x) & 0xff) ? \
- compile_ffs8(__x) : (compile_ffs8((__x) >> 8) + 8) )
+ __builtin_choose_expr(((__x) & 0xff), \
+ (compile_ffs8((__x))), \
+ (compile_ffs8((__x) >> 8) + 8))
#define compile_ffs32(__x) \
- ( ((__x) & 0xffff) ? \
- compile_ffs16(__x) : (compile_ffs16((__x) >> 16) + 16) )
+ __builtin_choose_expr(((__x) & 0xffff), \
+ (compile_ffs16((__x))), \
+ (compile_ffs16((__x) >> 16) + 16))
/*
* This macro will check the requirements for the FIELD{8,16,32} macros