Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753854AbdGNJeN (ORCPT ); Fri, 14 Jul 2017 05:34:13 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:57062 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751353AbdGNJeM (ORCPT ); Fri, 14 Jul 2017 05:34:12 -0400 From: Arnd Bergmann To: linux-kernel@vger.kernel.org, Mark Brown , Andrew Morton Cc: Greg Kroah-Hartman , Linus Torvalds , Tejun Heo , Guenter Roeck , linux-ide@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, Arnd Bergmann , Masahiro Yamada , Charles Keepax Subject: [PATCH 13/14] iopoll: avoid -Wint-in-bool-context warning Date: Fri, 14 Jul 2017 11:31:06 +0200 Message-Id: <20170714093129.1366900-4-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170714092540.1217397-1-arnd@arndb.de> References: <20170714092540.1217397-1-arnd@arndb.de> X-Provags-ID: V03:K0:tnnYrfDDRfyG4HcqDwJLN4aLSknRSBuE/z7rCtZunbNl6HzWrdn Mluxjv41oMw9kwhLb54mqwTidWsf38sM6CvJ4fuWf8M/wN0AaByeJYzdOPk2iSRGxrWgYKq 70gphy5QwCukuiFJA/UeqJk0/58LDGWxrW5cH/JW9ZICXsb8ov2Tb0Kp0GTKMBNsv3o+BGZ P/GbdgBmZYltGEZGXhODA== X-UI-Out-Filterresults: notjunk:1;V01:K0:oR92X5Y4ipE=:tD0IaQagf+0Gu0E6CtDsuI IysTN4ZNHEIpgPothGAihexoW5kpXKo83XzA1No+v76N6BuZFHoJ2WROrucjmUuYFLSFNpDnH 4syQcaerNFk9WNDtBRRJwe8DnsraBRsRI3QoaXHxQhnYk4OLdiy2Gbda+Bhm8RbJ/ONRvcpHI UqEqjy8oHnM4CfwpkQqGhd3eCFzeRma26zjgZD185AAPMCeOirC5V+cw6zTeuegaRaifMf43p ohUDbinpJU1kkiYOsnBu92WuJQhjmcIflCjF0UEFMkzeO2zLddFR9w/HqTwQMnKnCIImSetlm mDprivMtth1mAa4f6qIXzFPev33PDUHuxZ5ZYjNGlEgfkOk1FXxuOvY6o5mfDVgcMtLXj8QwZ HzzSDlWnDqbqNk1++r3TJZb6GGQjcPtFLgPnJruxyuvz6lcV8E8ttOQMY2jXnePJLwDWTJeKc nWXPfSh/88sdRuhW9b1oEJhj7Z8nQS2d4iNPX0TnBgU+qfl7OzrRq07D1FkLVTozJJQiVguRB hR0TUCs6mVceaoszmtDiWeVI3au1zUgbyZzckfnpv+R4N05I37NYCi/24fECXYaIPQFZDNmWP WRwXHvEoXsGrvrXCvrCAAI+6l5tX69FWQM09n1mGnnzmG4Q5AUqab1AFXr4jlPaO3p9dXzSU9 jC2cG+361Hkc+WDKnI6W65dGEFN4X0a6tra23w72izQIDnBYzVGLjHaTSCUi3zqThWU+58eTi CFydOnPXlYVl66urk75cTeWL7Jw9Udlzftwjww== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1685 Lines: 54 When we pass the result of a multiplication as the timeout, we can get a warning: drivers/mmc/host/bcm2835.c:596:149: error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context] drivers/mfd/arizona-core.c:247:195: error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context] This is easy to avoid by comparing the timeout to zero instead, making it a boolean expression. Signed-off-by: Arnd Bergmann --- include/linux/iopoll.h | 6 ++++-- include/linux/regmap.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h index d29e1e21bf3f..7a17ba02253b 100644 --- a/include/linux/iopoll.h +++ b/include/linux/iopoll.h @@ -48,7 +48,8 @@ (val) = op(addr); \ if (cond) \ break; \ - if (timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \ + if ((timeout_us) > 0 && \ + ktime_compare(ktime_get(), timeout) > 0) { \ (val) = op(addr); \ break; \ } \ @@ -82,7 +83,8 @@ (val) = op(addr); \ if (cond) \ break; \ - if (timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \ + if ((timeout_us) > 0 && \ + ktime_compare(ktime_get(), timeout) > 0) { \ (val) = op(addr); \ break; \ } \ diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 1474ab0a3922..0889dbf37161 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -129,7 +129,7 @@ struct reg_sequence { break; \ if (cond) \ break; \ - if ((timeout_us) && \ + if ((timeout_us) > 0 && \ ktime_compare(ktime_get(), __timeout) > 0) { \ __ret = regmap_read((map), (addr), &(val)); \ break; \ -- 2.9.0