Skip to content

Commit 23e4c67

Browse files
arndbhtejun
authored andcommitted
ata: avoid gcc-7 warning in ata_timing_quantize
gcc-7 warns about the result of a constant multiplication used as a boolean: drivers/ata/libata-core.c: In function 'ata_timing_quantize': drivers/ata/libata-core.c:3164:30: warning: '*' in boolean context, suggest '&&' instead [-Wint-in-bool-context] This slightly rearranges the macro to simplify the code and avoid the warning at the same time. Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent c0da4fa commit 23e4c67

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

drivers/ata/libata-core.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3234,19 +3234,19 @@ static const struct ata_timing ata_timing[] = {
32343234
};
32353235

32363236
#define ENOUGH(v, unit) (((v)-1)/(unit)+1)
3237-
#define EZ(v, unit) ((v)?ENOUGH(v, unit):0)
3237+
#define EZ(v, unit) ((v)?ENOUGH(((v) * 1000), unit):0)
32383238

32393239
static void ata_timing_quantize(const struct ata_timing *t, struct ata_timing *q, int T, int UT)
32403240
{
3241-
q->setup = EZ(t->setup * 1000, T);
3242-
q->act8b = EZ(t->act8b * 1000, T);
3243-
q->rec8b = EZ(t->rec8b * 1000, T);
3244-
q->cyc8b = EZ(t->cyc8b * 1000, T);
3245-
q->active = EZ(t->active * 1000, T);
3246-
q->recover = EZ(t->recover * 1000, T);
3247-
q->dmack_hold = EZ(t->dmack_hold * 1000, T);
3248-
q->cycle = EZ(t->cycle * 1000, T);
3249-
q->udma = EZ(t->udma * 1000, UT);
3241+
q->setup = EZ(t->setup, T);
3242+
q->act8b = EZ(t->act8b, T);
3243+
q->rec8b = EZ(t->rec8b, T);
3244+
q->cyc8b = EZ(t->cyc8b, T);
3245+
q->active = EZ(t->active, T);
3246+
q->recover = EZ(t->recover, T);
3247+
q->dmack_hold = EZ(t->dmack_hold, T);
3248+
q->cycle = EZ(t->cycle, T);
3249+
q->udma = EZ(t->udma, UT);
32503250
}
32513251

32523252
void ata_timing_merge(const struct ata_timing *a, const struct ata_timing *b,

0 commit comments

Comments
 (0)