Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1687184 > unrolled thread
| Started by | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| First post | 2017-07-14 11:30 +0200 |
| Last post | 2017-07-15 13:00 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH, RESEND 02/14] ata: avoid gcc-7 warning in ata_timing_quantize Arnd Bergmann <arnd@arndb.de> - 2017-07-14 11:30 +0200
Re: [PATCH, RESEND 02/14] ata: avoid gcc-7 warning in ata_timing_quantize Tejun Heo <tj@kernel.org> - 2017-07-15 13:00 +0200
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2017-07-14 11:30 +0200 |
| Subject | [PATCH, RESEND 02/14] ata: avoid gcc-7 warning in ata_timing_quantize |
| Message-ID | <u3558-1oP-19@gated-at.bofh.it> |
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 <arnd@arndb.de>
---
drivers/ata/libata-core.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index fa7dd4394c02..450059dd06ba 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,
--
2.9.0
[toc] | [next] | [standalone]
| From | Tejun Heo <tj@kernel.org> |
|---|---|
| Date | 2017-07-15 13:00 +0200 |
| Subject | Re: [PATCH, RESEND 02/14] ata: avoid gcc-7 warning in ata_timing_quantize |
| Message-ID | <u3sXM-rr-25@gated-at.bofh.it> |
| In reply to | #1687184 |
On Fri, Jul 14, 2017 at 11:25:14AM +0200, Arnd Bergmann wrote: > 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 <arnd@arndb.de> If the whole series will be routed together, Acked-by: Tejun Heo <tj@kernel.org> If not, please let me know. I'll push it through libata/for-4.13-fixes. Thanks! -- tejun
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web