Skip to content

Commit 921edf3

Browse files
arndbdavem330
authored andcommitted
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>
1 parent 96080f6 commit 921edf3

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

‎drivers/ide/ide-timings.c‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,19 +104,19 @@ u16 ide_pio_cycle_time(ide_drive_t *drive, u8 pio)
104104
EXPORT_SYMBOL_GPL(ide_pio_cycle_time);
105105

106106
#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)
108108

109109
static void ide_timing_quantize(struct ide_timing *t, struct ide_timing *q,
110110
int T, int UT)
111111
{
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);
120120
}
121121

122122
void ide_timing_merge(struct ide_timing *a, struct ide_timing *b,

0 commit comments

Comments
 (0)