On Sun, Feb 19, 2017 at 2:10 AM, Lars-Peter Clausen <lars@xxxxxxxxxx> wrote: > On 02/18/2017 09:21 PM, sayli karnik wrote: >> Use GENMASK() macro for left shifting integers. >> Done using coccinelle: >> @@ int a,b; @@ >> >> -(a << b) >> +GENMASK(a, b) >> >> Signed-off-by: sayli karnik <karniksayli1995@xxxxxxxxx> > > Hi, > > Thanks for the patch. Looks mostly good, but please rework the patch for > version 2 to address the comments for patch 1. > Yes I am sending another version. > Some additional comments inline. > > [...] >> /* Setup Register Bit Designations (AD7152_REG_CHx_SETUP) */ >> #define AD7152_SETUP_CAPDIFF BIT(5) >> -#define AD7152_SETUP_RANGE_2pF (0 << 6) >> +#define AD7152_SETUP_RANGE_2pF GENMASK(0, 6) >> #define AD7152_SETUP_RANGE_0_5pF BIT(6) >> -#define AD7152_SETUP_RANGE_1pF (2 << 6) >> -#define AD7152_SETUP_RANGE_4pF (3 << 6) >> +#define AD7152_SETUP_RANGE_1pF GENMASK(2, 6) >> +#define AD7152_SETUP_RANGE_4pF GENMASK(3, 6) >> #define AD7152_SETUP_RANGE(x) ((x) << 6) > > AD7152_SETUP_RANGE() can also use the GENMASK() macro > > [...] >> /* 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 Should I still remove them? thanks, sayli > -- > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@xxxxxxxxxxxxxxxx. > To post to this group, send email to outreachy-kernel@xxxxxxxxxxxxxxxx. > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/0b5ef4d0-14b5-1196-8bc4-deda9d8f75ce%40metafoo.de. > For more options, visit https://groups.google.com/d/optout. -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html