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: 9840351 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 8D73E60212 for ; Fri, 14 Jul 2017 09:34:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7ED6A2876A for ; Fri, 14 Jul 2017 09:34:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73A3928777; Fri, 14 Jul 2017 09:34:14 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F24F2876A for ; Fri, 14 Jul 2017 09:34:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753492AbdGNJeN (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 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 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-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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; \