All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [RESEND] ata: avoid gcc-7 warning in ata_timing_quantize
@ 2017-09-06 21:45 Arnd Bergmann
  2017-09-07 20:34 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2017-09-06 21:45 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Arnd Bergmann, linux-ide, linux-kernel

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>
---
Hi Tejun,

I just noticed this patch among others I had previously sent
but that were not applied. It seems I forgot to reply to your
Ack after it had become clear that the serious would not
get merged in one chunk. Please apply this for 4.14.

Link: https://patchwork.kernel.org/patch/9840269/
---
 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 1945a8ea2099..ee4c1ec9dca0 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3234,19 +3234,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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] [RESEND] ata: avoid gcc-7 warning in ata_timing_quantize
  2017-09-06 21:45 [PATCH] [RESEND] ata: avoid gcc-7 warning in ata_timing_quantize Arnd Bergmann
@ 2017-09-07 20:34 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2017-09-07 20:34 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-ide, linux-kernel

On Wed, Sep 06, 2017 at 11:45:34PM +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>
> ---
> Hi Tejun,
> 
> I just noticed this patch among others I had previously sent
> but that were not applied. It seems I forgot to reply to your
> Ack after it had become clear that the serious would not
> get merged in one chunk. Please apply this for 4.14.

My bad. I'm sorry. Applied to libata/for-4.14-fixes.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-07 20:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-06 21:45 [PATCH] [RESEND] ata: avoid gcc-7 warning in ata_timing_quantize Arnd Bergmann
2017-09-07 20:34 ` Tejun Heo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.