Re: [PATCH v2] linux/kernel.h: Fix DIV_ROUND_CLOSEST with unsigned divisors

2012-12-20 Thread Guenter Roeck
On Thu, Dec 20, 2012 at 11:22:02AM +0100, Jean Delvare wrote: > Hi Guenter, > > On Wed, 19 Dec 2012 14:41:22 -0800, Guenter Roeck wrote: > > On Wed, Dec 19, 2012 at 01:47:21PM -0800, Andrew Morton wrote: > > > The changelog didn't describe the end-user visible effects of the bug. > > > Please alwa

Re: [PATCH v2] linux/kernel.h: Fix DIV_ROUND_CLOSEST with unsigned divisors

2012-12-20 Thread Jean Delvare
On Wed, 19 Dec 2012 15:01:44 -0800, Guenter Roeck wrote: > On Wed, Dec 19, 2012 at 11:21:15PM +0100, Jean Delvare wrote: > > Hi Guenter, > > > > On Wed, 19 Dec 2012 06:40:15 -0800, Guenter Roeck wrote: > > > Commit 263a523 fixes a warning seen with W=1 due to change in > > > DIV_ROUND_CLOSEST. Unf

Re: [PATCH v2] linux/kernel.h: Fix DIV_ROUND_CLOSEST with unsigned divisors

2012-12-20 Thread Jean Delvare
Hi Juergen, On Thu, 20 Dec 2012 11:30:38 +0100, Juergen Beisert wrote: > Hi Jean, > > Jean Delvare wrote: > > On Wed, 19 Dec 2012 14:41:22 -0800, Guenter Roeck wrote: > > > One observed effect is that the s2c_hwmon driver reports a value of > > > 4198403 instead of 0 if the ADC reads 0. > > > > >

Re: [PATCH v2] linux/kernel.h: Fix DIV_ROUND_CLOSEST with unsigned divisors

2012-12-20 Thread Juergen Beisert
Hi Jean, Jean Delvare wrote: > On Wed, 19 Dec 2012 14:41:22 -0800, Guenter Roeck wrote: > > On Wed, Dec 19, 2012 at 01:47:21PM -0800, Andrew Morton wrote: > > > The changelog didn't describe the end-user visible effects of the bug. > > > Please always include this information. Because... > > > >

Re: [PATCH v2] linux/kernel.h: Fix DIV_ROUND_CLOSEST with unsigned divisors

2012-12-20 Thread Jean Delvare
Hi Guenter, On Wed, 19 Dec 2012 14:41:22 -0800, Guenter Roeck wrote: > On Wed, Dec 19, 2012 at 01:47:21PM -0800, Andrew Morton wrote: > > The changelog didn't describe the end-user visible effects of the bug. > > Please always include this information. Because... > > One observed effect is that

Re: [PATCH v2] linux/kernel.h: Fix DIV_ROUND_CLOSEST with unsigned divisors

2012-12-19 Thread Guenter Roeck
On Wed, Dec 19, 2012 at 11:21:15PM +0100, Jean Delvare wrote: > Hi Guenter, > > On Wed, 19 Dec 2012 06:40:15 -0800, Guenter Roeck wrote: > > Commit 263a523 fixes a warning seen with W=1 due to change in > > DIV_ROUND_CLOSEST. Unfortunately, the C compiler converts divide operations > > with unsign

Re: [PATCH v2] linux/kernel.h: Fix DIV_ROUND_CLOSEST with unsigned divisors

2012-12-19 Thread Guenter Roeck
On Wed, Dec 19, 2012 at 01:47:21PM -0800, Andrew Morton wrote: > On Wed, 19 Dec 2012 06:40:15 -0800 > Guenter Roeck wrote: > > > Commit 263a523 fixes a warning seen with W=1 due to change in > > DIV_ROUND_CLOSEST. Unfortunately, the C compiler converts divide operations > > with unsigned divisors

Re: [PATCH v2] linux/kernel.h: Fix DIV_ROUND_CLOSEST with unsigned divisors

2012-12-19 Thread Jean Delvare
Hi Guenter, On Wed, 19 Dec 2012 06:40:15 -0800, Guenter Roeck wrote: > Commit 263a523 fixes a warning seen with W=1 due to change in > DIV_ROUND_CLOSEST. Unfortunately, the C compiler converts divide operations > with unsigned divisors to unsigned, even if the dividend is signed and > negative (fo

Re: [PATCH v2] linux/kernel.h: Fix DIV_ROUND_CLOSEST with unsigned divisors

2012-12-19 Thread Andrew Morton
On Wed, 19 Dec 2012 06:40:15 -0800 Guenter Roeck wrote: > Commit 263a523 fixes a warning seen with W=1 due to change in > DIV_ROUND_CLOSEST. Unfortunately, the C compiler converts divide operations > with unsigned divisors to unsigned, even if the dividend is signed and > negative (for example, -

[PATCH v2] linux/kernel.h: Fix DIV_ROUND_CLOSEST with unsigned divisors

2012-12-19 Thread Guenter Roeck
Commit 263a523 fixes a warning seen with W=1 due to change in DIV_ROUND_CLOSEST. Unfortunately, the C compiler converts divide operations with unsigned divisors to unsigned, even if the dividend is signed and negative (for example, -10 / 5U = 858993457). The C standard says "If one operand has unsi