Thread (9 messages) 9 messages, 3 authors, 2017-02-19

Re: [Outreachy kernel] Re: [PATCH 2/3] staging: iio: ad7152: Use GENMASK() macro for left shifts

From: Lars-Peter Clausen <lars@metafoo.de>
Date: 2017-02-19 09:29:28

On 02/19/2017 07:01 AM, sayli karnik wrote:
[...]
quoted
[...]
quoted
 /* CFG2 Register Bit Designations (AD7152_REG_CFG2) */
-#define AD7152_CFG2_OSR(x)           (((x) & 0x3) << 4)
+#define AD7152_CFG2_OSR(x)           GENMASK(((x) & 0x3), 4)
The extra parenthesis around (x) & 0x3 are no needed when using the macro
(the macro will add them).
The outer parentheses are certainly not needed but for the ones around
x, checkpatch.pl complains otherwise-
CHECK: Macro argument 'x' may be better as '(x)' to avoid precedence issues
The one around x are needed and should stay.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help