Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1616347ybv; Fri, 21 Feb 2020 00:21:16 -0800 (PST) X-Google-Smtp-Source: APXvYqyOplMUkEomvzHerVRV4Yd53aJWUD94cG09rW9iqSAqCn97FRAJNIWWA6D5qAHUjae18eHH X-Received: by 2002:a9d:6184:: with SMTP id g4mr25608658otk.223.1582273276253; Fri, 21 Feb 2020 00:21:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582273276; cv=none; d=google.com; s=arc-20160816; b=XmI+5ELNKD2uN4xftp7UCKZ9YSw8Srg9H/A8Tn6GS8Q3TGgRQDiLhBot2D25KDtrvw w7KTsjwwlIzmJ7I7Ikpk+AjALPiprNNIJ2mqtPR/sB7ZWIg6Vg/jnGYyRWzx1pw30kv+ DY2MndssY7APY0ug9HhTdiyLSPHSJTBF6qJIsVhUmlbZ+Kfk8vzcZKcO64pRJbR7hWZ1 KqQPnsow+YN0BkvxXTEqY+UM3CX6rKQzqgBmyCtuac/UhzQ/XVv8UXyuphhtkQPQQjkx ExPYpZ5gecfkg9MwYu2puyNnFdzrEDhg3RdkpapuEh9Aa1rdxsbzdHSJPnRsDjAoPT2d lKZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cACgMtMQVlZ6FQ4073Z3Atw/B9MEQz8LKcsPslw9630=; b=WgnQRnvEKQ15GRDRrD9iJt/faeonHP1E7adsN9hW3SfZ501vtT48CJCdRva+VJr0y6 QQcAC75TfUKAihNXcSdW1ehB62dRR+oKjiijHdKf9dzWRB5TgmFrvWUCmnFvc4owlcJH WLnKfA7uWRwZZ6OWpwyPiQMTaarJZJmXCVUptHaTV2rLkvIu3ivfacPjYG1uK6vDjQa/ gxOymJCTWtxA/BG2A4phtl1xmqDGD05Cgue+wa45iT6BssUihj/BqnhoYu/f0aSgfgY1 8GA+VEnsb6fV4KPNK6Q/SdL9YvYdtdNiy5kz2WQdcpQ9v6yjNp9O9aHL8i+aLqY+dNfP AC7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dca5lb4U; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 g26si1057368otk.324.2020.02.21.00.21.03; Fri, 21 Feb 2020 00:21:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dca5lb4U; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387998AbgBUITY (ORCPT + 99 others); Fri, 21 Feb 2020 03:19:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:57840 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732901AbgBUITW (ORCPT ); Fri, 21 Feb 2020 03:19:22 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 192F62468F; Fri, 21 Feb 2020 08:19:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582273161; bh=wq7lxjt7cRlqyFc4oM2xYceah9Pd7LC/X/ok4YEThvs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dca5lb4URahPWGlxhZ1+Q/8vGoLWWzIHexZp3j2SuCypSpQm3iVRhFMWbSmrTEWv9 sYAxoxBk9yGOmeSutWhP3jZs2iPlLl6HKxPnW2AbQKc1MjqcXudWz/33NOcilkipTa M/CeXCgYpHqt8P1sAJAr7sO+JBmhVpbgtGzhpsnM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ezequiel Garcia , Nick Desaulniers , Nathan Chancellor , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.19 068/191] media: v4l2-device.h: Explicitly compare grp{id,mask} to zero in v4l2_device macros Date: Fri, 21 Feb 2020 08:40:41 +0100 Message-Id: <20200221072259.546521124@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200221072250.732482588@linuxfoundation.org> References: <20200221072250.732482588@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nathan Chancellor [ Upstream commit afb34781620274236bd9fc9246e22f6963ef5262 ] When building with Clang + -Wtautological-constant-compare, several of the ivtv and cx18 drivers warn along the lines of: drivers/media/pci/cx18/cx18-driver.c:1005:21: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare] cx18_call_hw(cx, CX18_HW_GPIO_RESET_CTRL, ^ drivers/media/pci/cx18/cx18-cards.h:18:37: note: expanded from macro 'CX18_HW_GPIO_RESET_CTRL' #define CX18_HW_GPIO_RESET_CTRL (1 << 6) ^ 1 warning generated. This warning happens because the shift operation is implicitly converted to a boolean in v4l2_device_mask_call_all before being negated. This can be solved by just comparing the mask result to 0 explicitly so that there is no boolean conversion. The ultimate goal is to enable -Wtautological-compare globally because there are several subwarnings that would be helpful to have. For visual consistency and avoidance of these warnings in the future, all of the implicitly boolean conversions in the v4l2_device macros are converted to explicit ones as well. Link: https://github.com/ClangBuiltLinux/linux/issues/752 Reviewed-by: Ezequiel Garcia Reviewed-by: Nick Desaulniers Signed-off-by: Nathan Chancellor Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- include/media/v4l2-device.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h index b330e4a08a6b8..40840fec337ca 100644 --- a/include/media/v4l2-device.h +++ b/include/media/v4l2-device.h @@ -372,7 +372,7 @@ static inline void v4l2_subdev_notify(struct v4l2_subdev *sd, struct v4l2_subdev *__sd; \ \ __v4l2_device_call_subdevs_p(v4l2_dev, __sd, \ - !(grpid) || __sd->grp_id == (grpid), o, f , \ + (grpid) == 0 || __sd->grp_id == (grpid), o, f , \ ##args); \ } while (0) @@ -404,7 +404,7 @@ static inline void v4l2_subdev_notify(struct v4l2_subdev *sd, ({ \ struct v4l2_subdev *__sd; \ __v4l2_device_call_subdevs_until_err_p(v4l2_dev, __sd, \ - !(grpid) || __sd->grp_id == (grpid), o, f , \ + (grpid) == 0 || __sd->grp_id == (grpid), o, f , \ ##args); \ }) @@ -432,8 +432,8 @@ static inline void v4l2_subdev_notify(struct v4l2_subdev *sd, struct v4l2_subdev *__sd; \ \ __v4l2_device_call_subdevs_p(v4l2_dev, __sd, \ - !(grpmsk) || (__sd->grp_id & (grpmsk)), o, f , \ - ##args); \ + (grpmsk) == 0 || (__sd->grp_id & (grpmsk)), o, \ + f , ##args); \ } while (0) /** @@ -463,8 +463,8 @@ static inline void v4l2_subdev_notify(struct v4l2_subdev *sd, ({ \ struct v4l2_subdev *__sd; \ __v4l2_device_call_subdevs_until_err_p(v4l2_dev, __sd, \ - !(grpmsk) || (__sd->grp_id & (grpmsk)), o, f , \ - ##args); \ + (grpmsk) == 0 || (__sd->grp_id & (grpmsk)), o, \ + f , ##args); \ }) -- 2.20.1