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. 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). -- 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