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: 107755 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp655362qge; Fri, 14 Jul 2017 02:34:14 -0700 (PDT) X-Received: by 10.84.177.36 with SMTP id w33mr15449247plb.302.1500024854461; Fri, 14 Jul 2017 02:34:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500024854; cv=none; d=google.com; s=arc-20160816; b=TuqoY4Qw5d6nGLbaE4DoEYDbxl84eKmwuAJQ8zu1CrOSxqBfngzY5K9SlyJCicf8+o d2tYp9XFxFJcGpjC/y3ePfGQffRRiNTpvc7vOJW3nc1z//gdxd/7+jbWXh1ahmXWOkOz G1hPZLDnYCWXfgzMfUJYkPpRR2yUUS6597P7NXLEpgsh+UYoyXLpULADBJ3fKQtlZTyt 4/tEzsVJAaIocServdOVnOg5G5MKc3fkXPtYECXkedqYrG2qJiCNS2eezvNB4G7/sP4u Dh6EsnTTjN4umY6qUUO0pbWD+UOWWbSl1oEqiE049itRJpr2Vs+S9TvyjQS9WyEVfpwM 7zJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=1IBwV/iGnL03Hh3vYG3CeX5Bw1BhoCfB9BhHuERhy/w=; b=e8N24PkR1AfcGbgLiC6fg2HuFfQrYsj/ejrjivOmSFIMzZoyvD/GUwSaMbd7v57mrq vMfeZmxk5G9NLBoBWDZXeMf1KNKk3nktkmCGL1bkVvL4JgtQVC7crrEk7OFE0sIx8dMh 6nhv1ikVT9O/dg1/DGKL+E03ZzSAayGbdAQyqd3rF16dHOwZxZnshp5OxvuUqL9KKTw1 NR9CLsJASFwHAI9+jfBIk/vHBjJRet6RLqv64MUYtei6L6I9APXv4z+KuegYyn0IrCvH BcKwfA7MIEekyhv4GM03QP/OGYQIt586YeTmxAVL7JG/JwsOyceWYsaOg0tMDfPvRe9G lBug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-media-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n78si6063925pfg.444.2017.07.14.02.34.14; Fri, 14 Jul 2017 02:34:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-media-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753492AbdGNJeN (ORCPT + 4 others); 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 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(-) -- 2.9.0 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; \