Message ID | CA+55aFx5mCk+nzDG+gGzDUqE4gzJVERL_oO+PN-PA6oKaUhCpg@mail.gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Wed, Jul 12, 2017 at 5:41 AM, Linus Torvalds <torvalds@linux-foundation.org> wrote: > > We also have about a bazillion > > warning: ‘*’ in boolean context, suggest ‘&&’ instead > > warnings in drivers/ata/libata-core.c, all due to a single macro that > uses a pattern that gcc-7.1.1 doesn't like. The warning looks a bit > debatable, but I suspect the macro could easily be changed too. > > Tejun, would you hate just moving the "multiply by 1000" part _into_ > that EZ() macro? Something like the attached (UNTESTED!) patch? Tejun applied an almost identical patch of mine a while ago, but it seems to have gotten lost in the meantime in some rebase: https://patchwork.kernel.org/patch/9721397/ https://patchwork.kernel.org/patch/9721399/ I guess I should have resubmitted the second patch with the suggested improvement. Arnd
Hello, On Wed, Jul 12, 2017 at 03:31:02PM +0200, Arnd Bergmann wrote: > > We also have about a bazillion > > > > warning: ‘*’ in boolean context, suggest ‘&&’ instead > > > > warnings in drivers/ata/libata-core.c, all due to a single macro that > > uses a pattern that gcc-7.1.1 doesn't like. The warning looks a bit > > debatable, but I suspect the macro could easily be changed too. > > > > Tejun, would you hate just moving the "multiply by 1000" part _into_ > > that EZ() macro? Something like the attached (UNTESTED!) patch? > > Tejun applied an almost identical patch of mine a while ago, but it seems to > have gotten lost in the meantime in some rebase: Yeah, I was scratching my head remembering your patch. Sorry about that. It should have been routed through for-4.12-fixes. > https://patchwork.kernel.org/patch/9721397/ > https://patchwork.kernel.org/patch/9721399/ > > I guess I should have resubmitted the second patch with the suggested > improvement. The new one looks good to me. Thanks.
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 8453f9a4682f..4c7d5a138495 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -3231,19 +3231,19 @@ static const struct ata_timing ata_timing[] = { }; #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) static void ata_timing_quantize(const struct ata_timing *t, struct ata_timing *q, int T, int UT) { - q->setup = EZ(t->setup * 1000, T); - q->act8b = EZ(t->act8b * 1000, T); - q->rec8b = EZ(t->rec8b * 1000, T); - q->cyc8b = EZ(t->cyc8b * 1000, T); - q->active = EZ(t->active * 1000, T); - q->recover = EZ(t->recover * 1000, T); - q->dmack_hold = EZ(t->dmack_hold * 1000, T); - q->cycle = EZ(t->cycle * 1000, T); - q->udma = EZ(t->udma * 1000, UT); + q->setup = EZ(t->setup, T); + q->act8b = EZ(t->act8b, T); + q->rec8b = EZ(t->rec8b, T); + q->cyc8b = EZ(t->cyc8b, T); + q->active = EZ(t->active, T); + q->recover = EZ(t->recover, T); + q->dmack_hold = EZ(t->dmack_hold, T); + q->cycle = EZ(t->cycle, T); + q->udma = EZ(t->udma, UT); } void ata_timing_merge(const struct ata_timing *a, const struct ata_timing *b,