aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2017-07-14 05:25:13 -0400
committerDavid S. Miller <davem@davemloft.net>2017-07-20 23:37:22 -0400
commit921edf312a6a20be16cf2b60e0dec3dce35e5cb9 (patch)
treede7a67d798a76de632c56effdf29109fc2af760a
parent96080f697786e0a30006fcbcc5b53f350fcb3e9f (diff)
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>
-rw-r--r--drivers/ide/ide-timings.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/ide/ide-timings.c b/drivers/ide/ide-timings.c
index 0e05f75934c9..1858e3ce3993 100644
--- a/drivers/ide/ide-timings.c
+++ b/drivers/ide/ide-timings.c
@@ -104,19 +104,19 @@ u16 ide_pio_cycle_time(ide_drive_t *drive, u8 pio)
104EXPORT_SYMBOL_GPL(ide_pio_cycle_time); 104EXPORT_SYMBOL_GPL(ide_pio_cycle_time);
105 105
106#define ENOUGH(v, unit) (((v) - 1) / (unit) + 1) 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
109static void ide_timing_quantize(struct ide_timing *t, struct ide_timing *q, 109static void ide_timing_quantize(struct ide_timing *t, struct ide_timing *q,
110 int T, int UT) 110 int T, int UT)
111{ 111{
112 q->setup = EZ(t->setup * 1000, T); 112 q->setup = EZ(t->setup, T);
113 q->act8b = EZ(t->act8b * 1000, T); 113 q->act8b = EZ(t->act8b, T);
114 q->rec8b = EZ(t->rec8b * 1000, T); 114 q->rec8b = EZ(t->rec8b, T);
115 q->cyc8b = EZ(t->cyc8b * 1000, T); 115 q->cyc8b = EZ(t->cyc8b, T);
116 q->active = EZ(t->active * 1000, T); 116 q->active = EZ(t->active, T);
117 q->recover = EZ(t->recover * 1000, T); 117 q->recover = EZ(t->recover, T);
118 q->cycle = EZ(t->cycle * 1000, T); 118 q->cycle = EZ(t->cycle, T);
119 q->udma = EZ(t->udma * 1000, UT); 119 q->udma = EZ(t->udma, UT);
120} 120}
121 121
122void ide_timing_merge(struct ide_timing *a, struct ide_timing *b, 122void ide_timing_merge(struct ide_timing *a, struct ide_timing *b,