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

2016-03-19 Thread Arnd Bergmann
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_PIODT2821_SUPCSR_DS(0) > #define

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

2016-03-19 Thread Hartley Sweeten
On Tuesday, March 15, 2016 2:50 PM, Arnd Bergmann wrote: > On Tuesday 15 March 2016 21:35:40 Hartley Sweeten wrote: >> On Monday, March 14, 2016 3:48 PM, Arnd Bergmann wrote: >>> gcc-6 warns about passing negative signed integer into swab16() >>> in the dt282x driver: >> >> >> >>> The warning

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

2016-03-15 Thread Arnd Bergmann
On Tuesday 15 March 2016 21:35:40 Hartley Sweeten wrote: > On Monday, March 14, 2016 3:48 PM, Arnd Bergmann wrote: > > gcc-6 warns about passing negative signed integer into swab16() > > in the dt282x driver: > > > > > The warning makes sense, though the code is correct as far as I > > can

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

2016-03-15 Thread Hartley Sweeten
On Monday, March 14, 2016 3:48 PM, Arnd Bergmann wrote: > gcc-6 warns about passing negative signed integer into swab16() > in the dt282x driver: > The warning makes sense, though the code is correct as far as I > can tell. > > This disambiguates the operation by making the constant expressions

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

2016-03-14 Thread Arnd Bergmann
gcc-6 warns about passing negative signed integer into swab16() in the dt282x driver: drivers/staging/comedi/drivers/dt282x.c: In function 'dt282x_load_changain': include/uapi/linux/swab.h:14:33: warning: integer overflow in expression [-Woverflow] (((__u16)(x) & (__u16)0xff00U) >> 8)))