Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ide: avoid warning for timings calculation

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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Arnd Bergmann and committed by
David S. Miller
921edf31 96080f69

+9 -9
+9 -9
drivers/ide/ide-timings.c
··· 104 104 EXPORT_SYMBOL_GPL(ide_pio_cycle_time); 105 105 106 106 #define ENOUGH(v, unit) (((v) - 1) / (unit) + 1) 107 - #define EZ(v, unit) ((v) ? ENOUGH(v, unit) : 0) 107 + #define EZ(v, unit) ((v) ? ENOUGH((v) * 1000, unit) : 0) 108 108 109 109 static void ide_timing_quantize(struct ide_timing *t, struct ide_timing *q, 110 110 int T, int UT) 111 111 { 112 - q->setup = EZ(t->setup * 1000, T); 113 - q->act8b = EZ(t->act8b * 1000, T); 114 - q->rec8b = EZ(t->rec8b * 1000, T); 115 - q->cyc8b = EZ(t->cyc8b * 1000, T); 116 - q->active = EZ(t->active * 1000, T); 117 - q->recover = EZ(t->recover * 1000, T); 118 - q->cycle = EZ(t->cycle * 1000, T); 119 - q->udma = EZ(t->udma * 1000, UT); 112 + q->setup = EZ(t->setup, T); 113 + q->act8b = EZ(t->act8b, T); 114 + q->rec8b = EZ(t->rec8b, T); 115 + q->cyc8b = EZ(t->cyc8b, T); 116 + q->active = EZ(t->active, T); 117 + q->recover = EZ(t->recover, T); 118 + q->cycle = EZ(t->cycle, T); 119 + q->udma = EZ(t->udma, UT); 120 120 } 121 121 122 122 void ide_timing_merge(struct ide_timing *a, struct ide_timing *b,