From patchwork Mon Sep 30 12:03:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13816040 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 466ACCF6499 for ; Mon, 30 Sep 2024 12:09:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4cqERgoR9OlhV9bZcAYTWgDv58ZKeW9/q+4TIB0lCLc=; b=bmH+KSvIEbQMM29n1kiNFsCypB i0NaKthsb3Pop3gVQcy8VYf4FtBWxjDwh3vKh9rBJc9B8Fy7VuKhlN+IhJ9+yT1s2VvCa7Lmwu2dz pgFP65u3bsbgII2C1FfX6OOQ3IdLLkl5RQBzLyndR6pkpvvjqiH1gOmZtGc+bl3+wIB6Gr/NxmZpz /iffovkop84v769vMzEa36dOTVJzysStoWcWBV7AojwJyUZ8W16ED0l0/Hvv78sPnZKZ8of+p/6jQ txrwYum56/nnUpGHVpUQfHIJOzWXRi+HynFrCC52EDnmqdfe+B3D/y/m12TCXE3hj+CM8rBzoUNPH MUwFrzHw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1svFD6-0000000Gxcs-2T4m; Mon, 30 Sep 2024 12:09:04 +0000 Received: from mail-qv1-xf34.google.com ([2607:f8b0:4864:20::f34]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1svF8M-0000000GwAA-2IWf for linux-arm-kernel@lists.infradead.org; Mon, 30 Sep 2024 12:04:11 +0000 Received: by mail-qv1-xf34.google.com with SMTP id 6a1803df08f44-6cb4c013b78so18076286d6.1 for ; Mon, 30 Sep 2024 05:04:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1727697849; x=1728302649; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=4cqERgoR9OlhV9bZcAYTWgDv58ZKeW9/q+4TIB0lCLc=; b=k55kZoi3F60w0JeK3C5ObOvQLN6l8WuPuRO0uILao4cosV7toZDr8TRObDSKPTQFKF ixKvyBkvl02CnA6ihhffJ0t6hgJt8980pzdDLCPuffGMJByLdBbY+ymrpEnWDFVfTlXX 8rObJurXXiQa8RTG2PowJuK+NyV/b6Z2cL+dU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727697849; x=1728302649; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4cqERgoR9OlhV9bZcAYTWgDv58ZKeW9/q+4TIB0lCLc=; b=oHqs8b7yTICE2LgKsoKbxA5059NsjlBtp5KZBKjWJaDmxQSmHEMc8+ZRKR2kgwgmsl EvWbs4SIOGfhflnZvbWKvf80+vMiKcQSpMyeezM7XbqJsxAWS8kKz7ON+PQ+v5TcXG49 zoVJkKJDdZOSAsokTW6a9xIu401m3H4H0lEQ1xiTOm4P10RICPSki9SjqIH11B3xKGd6 FLM8wH38aFnC7RlIbksL/u6w0UmjqYuHnQuixXPx2ZCO7s3opPdROs5l7v5kVKy51H7H rT3EKF7xLWtt/IFDFljv+OMqZcPwQCF7O94zMKW0wnLidQP9wUXNU2JRU822veU97Kog VmXQ== X-Forwarded-Encrypted: i=1; AJvYcCUOmoFn/Natr2978UZ1SU3qy3+vTAJJ5hMfMrefYpb2M/ngnr4Q5a12b8C5oFSdaVZ0RfH4J/RkWpMEm1G0I15v@lists.infradead.org X-Gm-Message-State: AOJu0YzVtmxIML+7IHq6mAY4Ejf6X83I4j6U1rl5lPoS7iQftmBZ+eAj g7ECUYoMFJ8p5BHFW18KpSpeQbgI0+ZBGNzT+Sl0mqAd0B9Ir/DVJcOGnIoFzw== X-Google-Smtp-Source: AGHT+IGdCSwCLQh27OqCiMv81An8yCyEXTlCQao91e2evQ6yJY9lhvUOeYdfvxJFC6O2qm9bRDYGaQ== X-Received: by 2002:a05:6214:5247:b0:6c5:166e:566c with SMTP id 6a1803df08f44-6cb3b5f06c1mr193464746d6.28.1727697848951; Mon, 30 Sep 2024 05:04:08 -0700 (PDT) Received: from denia.c.googlers.com (76.224.245.35.bc.googleusercontent.com. [35.245.224.76]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6cb3b694369sm38822536d6.144.2024.09.30.05.04.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 05:04:07 -0700 (PDT) From: Ricardo Ribalda Date: Mon, 30 Sep 2024 12:03:58 +0000 Subject: [PATCH 03/45] media: core: Use string_choices helpers MIME-Version: 1.0 Message-Id: <20240930-cocci-opportunity-v1-3-81e137456ce0@chromium.org> References: <20240930-cocci-opportunity-v1-0-81e137456ce0@chromium.org> In-Reply-To: <20240930-cocci-opportunity-v1-0-81e137456ce0@chromium.org> To: Sakari Ailus , Bingbu Cao , Tianshu Qiu , Mauro Carvalho Chehab , Greg Kroah-Hartman , Hans de Goede , Andy Shevchenko , Hans Verkuil , Mike Isely , Olli Salonen , Maxim Levitsky , Sean Young , Sergey Kozlov , Abylay Ospan , Jemma Denson , Patrick Boettcher , Ming Qian , Zhou Peng , Andy Walls , Laurent Pinchart , Michal Simek , Jean-Christophe Trotin , Philipp Zabel , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Eddie James , Joel Stanley , Andrew Jeffery , Hans Verkuil , Tomasz Figa , Marek Szyprowski , Tim Harvey , Benjamin Mugnier , Sylvain Petinot , Jacopo Mondi , Kieran Bingham , Laurent Pinchart , =?utf-8?q?Ni?= =?utf-8?q?klas_S=C3=B6derlund?= Cc: linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, openbmc@lists.ozlabs.org, linux-aspeed@lists.ozlabs.org, Ricardo Ribalda X-Mailer: b4 0.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240930_050410_622641_1777A391 X-CRM114-Status: GOOD ( 11.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The following cocci warnings are fixed: drivers/media/v4l2-core/v4l2-fwnode.c:282:32-33: opportunity for str_high_low(v) drivers/media/v4l2-core/v4l2-fwnode.c:290:32-33: opportunity for str_high_low(v) drivers/media/v4l2-core/v4l2-fwnode.c:298:37-38: opportunity for str_high_low(v) drivers/media/v4l2-core/v4l2-fwnode.c:329:31-32: opportunity for str_high_low(v) drivers/media/v4l2-core/v4l2-fwnode.c:356:40-41: opportunity for str_high_low(v) drivers/media/v4l2-core/v4l2-fwnode.c:364:38-39: opportunity for str_high_low(v) drivers/media/v4l2-core/v4l2-ctrls-core.c:272:16-26: opportunity for str_true_false(* ptr . p_s32) Signed-off-by: Ricardo Ribalda --- drivers/media/v4l2-core/v4l2-ctrls-core.c | 3 ++- drivers/media/v4l2-core/v4l2-fwnode.c | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-ctrls-core.c b/drivers/media/v4l2-core/v4l2-ctrls-core.c index eeab6a5eb7ba..f303c70dffae 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls-core.c +++ b/drivers/media/v4l2-core/v4l2-ctrls-core.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -269,7 +270,7 @@ void v4l2_ctrl_type_op_log(const struct v4l2_ctrl *ctrl) pr_cont("%d", *ptr.p_s32); break; case V4L2_CTRL_TYPE_BOOLEAN: - pr_cont("%s", *ptr.p_s32 ? "true" : "false"); + pr_cont("%s", str_true_false(*ptr.p_s32)); break; case V4L2_CTRL_TYPE_MENU: pr_cont("%s", ctrl->qmenu[*ptr.p_s32]); diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c index f19c8adf2c61..92dc17179018 100644 --- a/drivers/media/v4l2-core/v4l2-fwnode.c +++ b/drivers/media/v4l2-core/v4l2-fwnode.c @@ -279,7 +279,7 @@ v4l2_fwnode_endpoint_parse_parallel_bus(struct fwnode_handle *fwnode, V4L2_MBUS_HSYNC_ACTIVE_LOW); flags |= v ? V4L2_MBUS_HSYNC_ACTIVE_HIGH : V4L2_MBUS_HSYNC_ACTIVE_LOW; - pr_debug("hsync-active %s\n", v ? "high" : "low"); + pr_debug("hsync-active %s\n", str_high_low(v)); } if (!fwnode_property_read_u32(fwnode, "vsync-active", &v)) { @@ -287,7 +287,7 @@ v4l2_fwnode_endpoint_parse_parallel_bus(struct fwnode_handle *fwnode, V4L2_MBUS_VSYNC_ACTIVE_LOW); flags |= v ? V4L2_MBUS_VSYNC_ACTIVE_HIGH : V4L2_MBUS_VSYNC_ACTIVE_LOW; - pr_debug("vsync-active %s\n", v ? "high" : "low"); + pr_debug("vsync-active %s\n", str_high_low(v)); } if (!fwnode_property_read_u32(fwnode, "field-even-active", &v)) { @@ -295,7 +295,7 @@ v4l2_fwnode_endpoint_parse_parallel_bus(struct fwnode_handle *fwnode, V4L2_MBUS_FIELD_EVEN_LOW); flags |= v ? V4L2_MBUS_FIELD_EVEN_HIGH : V4L2_MBUS_FIELD_EVEN_LOW; - pr_debug("field-even-active %s\n", v ? "high" : "low"); + pr_debug("field-even-active %s\n", str_high_low(v)); } if (!fwnode_property_read_u32(fwnode, "pclk-sample", &v)) { @@ -326,7 +326,7 @@ v4l2_fwnode_endpoint_parse_parallel_bus(struct fwnode_handle *fwnode, V4L2_MBUS_DATA_ACTIVE_LOW); flags |= v ? V4L2_MBUS_DATA_ACTIVE_HIGH : V4L2_MBUS_DATA_ACTIVE_LOW; - pr_debug("data-active %s\n", v ? "high" : "low"); + pr_debug("data-active %s\n", str_high_low(v)); } if (fwnode_property_present(fwnode, "slave-mode")) { @@ -353,7 +353,7 @@ v4l2_fwnode_endpoint_parse_parallel_bus(struct fwnode_handle *fwnode, V4L2_MBUS_VIDEO_SOG_ACTIVE_LOW); flags |= v ? V4L2_MBUS_VIDEO_SOG_ACTIVE_HIGH : V4L2_MBUS_VIDEO_SOG_ACTIVE_LOW; - pr_debug("sync-on-green-active %s\n", v ? "high" : "low"); + pr_debug("sync-on-green-active %s\n", str_high_low(v)); } if (!fwnode_property_read_u32(fwnode, "data-enable-active", &v)) { @@ -361,7 +361,7 @@ v4l2_fwnode_endpoint_parse_parallel_bus(struct fwnode_handle *fwnode, V4L2_MBUS_DATA_ENABLE_LOW); flags |= v ? V4L2_MBUS_DATA_ENABLE_HIGH : V4L2_MBUS_DATA_ENABLE_LOW; - pr_debug("data-enable-active %s\n", v ? "high" : "low"); + pr_debug("data-enable-active %s\n", str_high_low(v)); } switch (bus_type) {