[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHp75VdWrBDN-Pb_WOLjim6ZhyN6dxwEzi_ekBNbzQ-tJuAeoQ@mail.gmail.com>
Date: Sat, 27 May 2017 23:22:55 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Arnd Bergmann <arnd@...db.de>
Cc: "David S. Miller" <davem@...emloft.net>, linux-ide@...r.kernel.org,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ide: avoid warning for timings calculation
On Thu, May 11, 2017 at 3:52 PM, Arnd Bergmann <arnd@...db.de> wrote:
> gcc-7 warns about the result of a constant multiplication used as
> a boolean:
>
> drivers/ide/ide-timings.c: In function 'ide_timing_quantize':
> drivers/ide/ide-timings.c:112:24: error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context]
> q->setup = EZ(t->setup * 1000, T);
>
> This slightly rearranges the macro to simplify the code and avoid
> the warning at the same time.
> #define ENOUGH(v, unit) (((v) - 1) / (unit) + 1)
> -#define EZ(v, unit) ((v) ? ENOUGH(v, unit) : 0)
> +#define EZ(v, unit) ((v) ? ENOUGH(v * 1000, unit) : 0)
Perhaps
v -> (v) in the multiplication.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists