From patchwork Fri Jul 14 09:31:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9840349 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4501960212 for ; Fri, 14 Jul 2017 09:34:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 35D0E2876A for ; Fri, 14 Jul 2017 09:34:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2AA6C28777; Fri, 14 Jul 2017 09:34:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AEF2D2876A for ; Fri, 14 Jul 2017 09:34:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 20FC26E105; Fri, 14 Jul 2017 09:34:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id 49EA06E105 for ; Fri, 14 Jul 2017 09:34:06 +0000 (UTC) Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.145]) with ESMTPA (Nemesis) id 0M4qhJ-1dr3cS1HEz-00z0h2; Fri, 14 Jul 2017 11:33:13 +0200 From: Arnd Bergmann To: linux-kernel@vger.kernel.org, Mark Brown , Andrew Morton 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== Cc: Arnd Bergmann , Masahiro Yamada , Greg Kroah-Hartman , dri-devel@lists.freedesktop.org, linux-ide@vger.kernel.org, Tejun Heo , Charles Keepax , Linus Torvalds , Guenter Roeck , linux-media@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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; \