Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1947935ybv; Fri, 14 Feb 2020 08:42:22 -0800 (PST) X-Google-Smtp-Source: APXvYqzAjy6+yQ4qAKMoVZumqtJvB7QKoxqLI7nDrKBcbulLabTq8hqEOMgXyux6Aqxy1AYiQgcs X-Received: by 2002:a9d:4c81:: with SMTP id m1mr2984839otf.5.1581698542260; Fri, 14 Feb 2020 08:42:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581698542; cv=none; d=google.com; s=arc-20160816; b=SjpDXpgoZBXV8xJBhL4/VrqBH+NkEWu3SmgDQn1Z0OerXAZk3/1s7aL+ubn9M/HHIZ faS3/3yl7AHPuYoFCMT/WTJpzclIzaFPDE3drW+v9mwfhgIWbnvVjBtR2X/xh0Cxp5NT JNTql4hje2HzwrB3c0H+kAsZcMtYJn0EjaPYMPIKwmNYG0bWTqolHoVGApGuTDEr5UTk 4vf/UtaIgGdIlQxl8Wg4SvmyoVfHLlVZJWe3M633QJyCPKQfEydb1sFDjnC9r+5HZVke D3kEa+lj0Xi316vL0kMhtO9iVtn2Aho8meST7fPMqIgRTyQLuzCbt6XuOz7vqkpx44e0 mbGg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nNv5CWEKhlbomAkpvyKNmuLlCwc/Mn81h836QvUw2bY=; b=OJs7MEWy8tyZx5Du7DXQPf9CVs5ssAiGdUvYmjLWnt/CiGWct6lO1yXgcCndifbv4P p5gV/4nZHd0CpluqFqJ8olKo/0YvXslOh70pJ8c1OrhSRLYfnczC5maAaERfx38uinEh fpNTUS9TxdDWbJRB3rUzjnMApPrCI0Zf/Iea+3UyS01jIQyTlqMpTrM52P4pKE1EcFrI kuBJSWrX2qEsKD1GtIffDk0K7bzO9wdM8l2OJbQz+9M55ejkvDNzLyIIdkT/PqhynzKv dXe1vK5esEVwLL6mk3KAHHOI79HUyP9HqmimxbYbhrrdZv4xHFQEdIaHxiD5n+bbjnQc qnKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bpsMnwmT; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s22si2788807oij.35.2020.02.14.08.42.10; Fri, 14 Feb 2020 08:42:22 -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=bpsMnwmT; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405532AbgBNQlg (ORCPT + 99 others); Fri, 14 Feb 2020 11:41:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:58194 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405482AbgBNQWf (ORCPT ); Fri, 14 Feb 2020 11:22:35 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CF43F24754; Fri, 14 Feb 2020 16:22:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581697353; bh=Y5SnXWp1oU7iqTSLhVAfbzVeZIBa+qAGHzZ8XluSOMY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bpsMnwmTq5wXrRv4dXjOI8rJyRFhcv+TIa2RKZdPkXhfwbBGgAy3XaUQJU4Urkmug 1LZS8Q8E9wNECxfgKLsQAgU3H4ueJpGSGsL4abap4A9acHWGo8FUjM0hz99r01s84f x15BpPFN0zI2KAqzTXdoFkEA0pRCjjRUO+HOWFqg= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Nathan Chancellor , Ezequiel Garcia , Nick Desaulniers , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin , linux-media@vger.kernel.org, clang-built-linux@googlegroups.com Subject: [PATCH AUTOSEL 4.9 056/141] media: v4l2-device.h: Explicitly compare grp{id,mask} to zero in v4l2_device macros Date: Fri, 14 Feb 2020 11:19:56 -0500 Message-Id: <20200214162122.19794-56-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200214162122.19794-1-sashal@kernel.org> References: <20200214162122.19794-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 8ffa94009d1a9..76002416cead9 100644 --- a/include/media/v4l2-device.h +++ b/include/media/v4l2-device.h @@ -268,7 +268,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) @@ -280,7 +280,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); \ }) @@ -294,8 +294,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) /* @@ -308,8 +308,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