Re: [PATCH] staging/comedi/dt282x: avoid integer overflow warning

From: Arnd Bergmann
Date: Wed Mar 16 2016 - 16:52:48 EST


On Wednesday 16 March 2016 17:04:15 Hartley Sweeten wrote:
> > #define DT2821_SUPCSR_DS_AD_TRIG (3 << 10)
>
> Use a helper macro for those bits:
>
> #define DT2821_SUPCSR_DS(x) (((x) & 0x3) << 10)
> #define DT2821_SUPCSR_DS_PIO DT2821_SUPCSR_DS(0)
> #define DT2821_SUPCSR_DS_AD_CLK DT2821_SUPCSR_DS(1)
> #define DT2821_SUPCSR_DS_DA_CLK DT2821_SUPCSR_DS(2)
> #define DT2821_SUPCSR_DS_AD_TRIG DT2821_SUPCSR_DS(3)
>
> > I considered using BIT() but decided against it for consistency.
>
> Your change may fix the gcc-6 issue but it doesn't fix the 28 checkpatch.pl
> issues:
> CHECK: Prefer using the BIT macro

I sent a new version now, and found a better solution that avoids
using BIT().

Arnd