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: 13815951 Received: from mail-qv1-f51.google.com (mail-qv1-f51.google.com [209.85.219.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5079E18EFF5 for ; Mon, 30 Sep 2024 12:04:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727697851; cv=none; b=jD9wtTcKkq+FgzaeaM2LmOrc8rj27iXpmyhUQ1XCGYPgnlwNYgiIQIWurRgfSaH0ifB8yGDkNqX4FWA2fv8fF150UiUgM05F0rof6xXqqmqXv0hWXRYP69KvaxhYkWyEBfIFY3+nVmrViQYgoUNcCBRR0RNlGaecpMi8M4+2CWs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727697851; c=relaxed/simple; bh=JRVPAXt8pgkLV9kf8+kVySmbvl1AqLOgaMkZBH8WTjc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RMICrFuraMd99tXa3tLl9SpxE0roBgYRirypviDIK9/feTBNoILATnksPcxK0fA/oBqMda/s4MvQxYloFymAKP7PiC9eEZlSYV6WuZkrKIJsV4epbIymIAxUDU1I9RPpK0Y4L7PyDNFgbcDZluGnKLynxt1cu4KFeoFthPnNR3g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=DWs8xvLm; arc=none smtp.client-ip=209.85.219.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="DWs8xvLm" Received: by mail-qv1-f51.google.com with SMTP id 6a1803df08f44-6cb4c013b78so18076336d6.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.linux.dev; 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=DWs8xvLmWh/dIxNX98UGLJ5+tvpzRYntdC8I1sjznbJgTwD3GbY7NV7Z7v5Wd4L6Dx DZEjkukABMyxtM1EzfGvM1PEcujGH7+GKEg2FkO7RiyZ6J/qXPYODSSaUtmG0M5GYABC uNur+YGwyttN7nKMvxsUKrMqHHCfwLw/QN/K4= 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=Opge+muT8JEk+jmem/I4nm6pvKC9IoLiMUZXalgIYIgM7+SSsFx7hY5PP4beqUtYw5 4270KWhUcBLCKXUamS9LULqxsHyLujdNmHwoldDKTCvMuAzbW5FHv6OyERfvOvRVmikt +Y9IPMAAFj4HtV2AKxU4tJGtPjxTVreruOf2mlP8+5qMwgoQEk08DlEsgFkkKeP347dc ZLRCgjZO5tFsc+yRz2ppM+fo6mkDqjW7wA/BPSQGrCBmi1s6jxsJX6uTu49wiPhxwam3 toniJ07/G2pMZnNW2v3XHRQunknA7ZrJNDQFbHlrRL52obeCTmjKk9OHlC956pKkuk9p ohfw== X-Forwarded-Encrypted: i=1; AJvYcCWcYXGnkW5VkTTOxCoYWej1U3cZLP/nBKgcv+/IDT2WVQrxrGh7FFbDORWWqS719Cp36V0=@lists.linux.dev X-Gm-Message-State: AOJu0YwSmAZJJRFyuyZu1U3ne90v+TofvfW2umljJEOquKcunNWichel eR4knKaXISFx6YEYJGmK4bfuABTHjInmXFa8bnYK/gxd9bcJsY6Huh/LfLM3Uw== 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 Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: 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 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) {