From patchwork Mon Sep 30 12:04:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13816262 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 39194CF6499 for ; Mon, 30 Sep 2024 12:43:52 +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=27WoLnk5gPTNJ0m2rtIWHwrzMjQJ4zxEXFjS8vXg2Uk=; b=ppoj81xEiTJcfHH8NuSpPLHejZ qIncB6bqBwCKPOv7bVK7OSkPl62E6STSpfsGn86h7Z/6s59PZavaXKgmThTli89uEBIL+df1HhB+3 K58gaJxrSRsU53tNKU5F2XrxX/3Q3NWNA6K7yNW2hzbtMifF+MPWYoN4xugb4EqVJj0lkx3Bdu0Ox hfpAMJ1d07AWBYa/ObqXLLU6S5dv6zs+WKTjsCDkMAcSvR7Pt3c+Daph54M+ZaY32LgKNKO91A6vK 1LGnQNjc/m/rVf+FUXH86G5CgpHnSqYcjGEcnYimyTYzrDTnCHXnina3pUxd636WRjnPsYf4G+ed3 PCls8YkQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1svFkc-0000000H7CB-3PEP; Mon, 30 Sep 2024 12:43:42 +0000 Received: from mail-qv1-xf31.google.com ([2607:f8b0:4864:20::f31]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1svF9O-0000000GweT-47dv for linux-arm-kernel@lists.infradead.org; Mon, 30 Sep 2024 12:05:16 +0000 Received: by mail-qv1-xf31.google.com with SMTP id 6a1803df08f44-6cb2e5d0104so32211466d6.3 for ; Mon, 30 Sep 2024 05:05:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1727697914; x=1728302714; 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=27WoLnk5gPTNJ0m2rtIWHwrzMjQJ4zxEXFjS8vXg2Uk=; b=FYj3Klzhvr36bY/RxGCOqT8OvTqzfjjz1JfUPbTJ8PZyx59B72zzExm279jv376KjA UI4KnAbyf+9gw/Ylq9lszM/MIOE9WdIYMxUbu+T1NehrhwMK6H5b6p8Ny0ogfdxqBo7d cH53JIzHfuvuVbYM+BIkuZbP/8Ce7swAd1OyQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727697914; x=1728302714; 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=27WoLnk5gPTNJ0m2rtIWHwrzMjQJ4zxEXFjS8vXg2Uk=; b=MpRxvZo70ZRH7JluhfGeK1iOVv7wZSwEA0QKW5JLmI4zuUpwU6E7mrfq9WezloSXiO rpEm/yQkerNfsTofy99DdbTfLIu5FoN40f+fZNrJMm/DyxnkRbqmEig4NnM5qVVgQDC6 iHWZ3uUILlJTAx4g8FW7OCfPovrlGt67qJlodzFbziG4PfCyaJgGyknOEeqjJdKsgbIe lWAT2cABNsu0AoKNhiXseolMCrOJ9asPkSAdkUubdsbMdgtNPLKNzeOyJaSQ2tSJefTk jnsk6Z2lqo9iDEbpJJZR3Fck+/SySly0XCx82Zc2Pbw7ywQkX8a+t89PPBYQutEs/vs5 frxQ== X-Forwarded-Encrypted: i=1; AJvYcCXPSWAfRdapbmvKBm+zFhOYNf/gSbqzg0w7HvkIu14lruqwNvuMefCKp/VIOIVQ9CABSK+nyOOSKqIWkPEjpPXK@lists.infradead.org X-Gm-Message-State: AOJu0YyTEQcyQVzVyDkGlPyOhvXGesPSOwpXpip96NTAnVqoq4BZbA0V UT33maiwoYmYXXeZKW6uecF7tRz5xu+35lI74SzBzfytX5q1PvP5N7kaZ2AFlg== X-Google-Smtp-Source: AGHT+IEmtR/kCt9kuVkbj7/r3Fqa0DixhR1uM5cl6xJKRSOoPA3YSLhx2F2SjU4khmzc/KfhSVtoIQ== X-Received: by 2002:a05:6214:4a87:b0:6cb:6059:92a with SMTP id 6a1803df08f44-6cb60590d50mr62400906d6.10.1727697913781; Mon, 30 Sep 2024 05:05:13 -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.05.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 05:05:12 -0700 (PDT) From: Ricardo Ribalda Date: Mon, 30 Sep 2024 12:04:30 +0000 Subject: [PATCH 35/45] media: i2c: tc358743: Use string_choices helpers MIME-Version: 1.0 Message-Id: <20240930-cocci-opportunity-v1-35-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_050515_071287_70BCAD73 X-CRM114-Status: GOOD ( 10.97 ) 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/i2c/tc358743.c:370:46-52: opportunity for str_enable_disable(enable) drivers/media/i2c/tc358743.c:1325:32-63: opportunity for str_on_off(hdmi_sys_status & MASK_S_AVMUTE) drivers/media/i2c/tc358743.c:1264:35-54: opportunity for str_on_off(sysctl & MASK_SLEEP) drivers/media/i2c/tc358743.c:1187:14-19: opportunity for str_yes_no(tx_5v) drivers/media/i2c/tc358743.c:1266:3-33: opportunity for str_yes_no(hdmi_sys_status & MASK_S_DDC5V) drivers/media/i2c/tc358743.c:1319:3-32: opportunity for str_yes_no(hdmi_sys_status & MASK_S_HDCP) drivers/media/i2c/tc358743.c:1281:3-35: opportunity for str_yes_no(hdmi_sys_status & MASK_S_PHY_PLL) drivers/media/i2c/tc358743.c:1283:3-36: opportunity for str_yes_no(hdmi_sys_status & MASK_S_PHY_SCDT) drivers/media/i2c/tc358743.c:1279:3-32: opportunity for str_yes_no(hdmi_sys_status & MASK_S_SYNC) drivers/media/i2c/tc358743.c:1277:3-32: opportunity for str_yes_no(hdmi_sys_status & MASK_S_TMDS) drivers/media/i2c/tc358743.c:1274:3-37: opportunity for str_yes_no(( i2c_rd16 ( sd , CECEN ) & MASK_CECEN )) drivers/media/i2c/tc358743.c:1309:3-42: opportunity for str_yes_no(( i2c_rd16 ( sd , CSI_STATUS ) & MASK_S_HLT )) drivers/media/i2c/tc358743.c:1306:3-44: opportunity for str_yes_no(( i2c_rd16 ( sd , CSI_STATUS ) & MASK_S_RXACT )) drivers/media/i2c/tc358743.c:1303:3-44: opportunity for str_yes_no(( i2c_rd16 ( sd , CSI_STATUS ) & MASK_S_TXACT )) drivers/media/i2c/tc358743.c:1300:3-44: opportunity for str_yes_no(( i2c_rd16 ( sd , CSI_STATUS ) & MASK_S_WSYNC )) drivers/media/i2c/tc358743.c:1268:3-50: opportunity for str_yes_no(( i2c_rd8 ( sd , EDID_MODE ) & MASK_EDID_MODE_E_DDC )) drivers/media/i2c/tc358743.c:1271:3-41: opportunity for str_yes_no(( i2c_rd8 ( sd , HPD_CTL ) & MASK_HPD_OUT0 )) Signed-off-by: Ricardo Ribalda --- drivers/media/i2c/tc358743.c | 44 +++++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c index 65d58ddf0287..f2e1e55ae190 100644 --- a/drivers/media/i2c/tc358743.c +++ b/drivers/media/i2c/tc358743.c @@ -367,8 +367,8 @@ static void tc358743_delayed_work_enable_hotplug(struct work_struct *work) static void tc358743_set_hdmi_hdcp(struct v4l2_subdev *sd, bool enable) { - v4l2_dbg(2, debug, sd, "%s: %s\n", __func__, enable ? - "enable" : "disable"); + v4l2_dbg(2, debug, sd, "%s: %s\n", __func__, + str_enable_disable(enable)); if (enable) { i2c_wr8_and_or(sd, HDCP_REG3, ~KEY_RD_CMD, KEY_RD_CMD); @@ -1184,7 +1184,7 @@ static void tc358743_hdmi_sys_int_handler(struct v4l2_subdev *sd, bool *handled) bool tx_5v = tx_5v_power_present(sd); v4l2_dbg(1, debug, sd, "%s: Tx 5V power present: %s\n", - __func__, tx_5v ? "yes" : "no"); + __func__, str_yes_no(tx_5v)); if (tx_5v) { tc358743_enable_edid(sd); @@ -1261,26 +1261,24 @@ static int tc358743_log_status(struct v4l2_subdev *sd) !!(sysctl & MASK_CECRST), !!(sysctl & MASK_CTXRST), !!(sysctl & MASK_HDMIRST)); - v4l2_info(sd, "Sleep mode: %s\n", sysctl & MASK_SLEEP ? "on" : "off"); + v4l2_info(sd, "Sleep mode: %s\n", str_on_off(sysctl & MASK_SLEEP)); v4l2_info(sd, "Cable detected (+5V power): %s\n", - hdmi_sys_status & MASK_S_DDC5V ? "yes" : "no"); + str_yes_no(hdmi_sys_status & MASK_S_DDC5V)); v4l2_info(sd, "DDC lines enabled: %s\n", - (i2c_rd8(sd, EDID_MODE) & MASK_EDID_MODE_E_DDC) ? - "yes" : "no"); + str_yes_no(i2c_rd8(sd, EDID_MODE) & MASK_EDID_MODE_E_DDC)); v4l2_info(sd, "Hotplug enabled: %s\n", - (i2c_rd8(sd, HPD_CTL) & MASK_HPD_OUT0) ? - "yes" : "no"); + str_yes_no(i2c_rd8(sd, HPD_CTL) & MASK_HPD_OUT0)); v4l2_info(sd, "CEC enabled: %s\n", - (i2c_rd16(sd, CECEN) & MASK_CECEN) ? "yes" : "no"); + str_yes_no(i2c_rd16(sd, CECEN) & MASK_CECEN)); v4l2_info(sd, "-----Signal status-----\n"); v4l2_info(sd, "TMDS signal detected: %s\n", - hdmi_sys_status & MASK_S_TMDS ? "yes" : "no"); + str_yes_no(hdmi_sys_status & MASK_S_TMDS)); v4l2_info(sd, "Stable sync signal: %s\n", - hdmi_sys_status & MASK_S_SYNC ? "yes" : "no"); + str_yes_no(hdmi_sys_status & MASK_S_SYNC)); v4l2_info(sd, "PHY PLL locked: %s\n", - hdmi_sys_status & MASK_S_PHY_PLL ? "yes" : "no"); + str_yes_no(hdmi_sys_status & MASK_S_PHY_PLL)); v4l2_info(sd, "PHY DE detected: %s\n", - hdmi_sys_status & MASK_S_PHY_SCDT ? "yes" : "no"); + str_yes_no(hdmi_sys_status & MASK_S_PHY_SCDT)); if (tc358743_get_detected_timings(sd, &timings)) { v4l2_info(sd, "No video detected\n"); @@ -1297,17 +1295,13 @@ static int tc358743_log_status(struct v4l2_subdev *sd) v4l2_info(sd, "Lanes in use: %d\n", state->csi_lanes_in_use); v4l2_info(sd, "Waiting for particular sync signal: %s\n", - (i2c_rd16(sd, CSI_STATUS) & MASK_S_WSYNC) ? - "yes" : "no"); + str_yes_no(i2c_rd16(sd, CSI_STATUS) & MASK_S_WSYNC)); v4l2_info(sd, "Transmit mode: %s\n", - (i2c_rd16(sd, CSI_STATUS) & MASK_S_TXACT) ? - "yes" : "no"); + str_yes_no(i2c_rd16(sd, CSI_STATUS) & MASK_S_TXACT)); v4l2_info(sd, "Receive mode: %s\n", - (i2c_rd16(sd, CSI_STATUS) & MASK_S_RXACT) ? - "yes" : "no"); + str_yes_no(i2c_rd16(sd, CSI_STATUS) & MASK_S_RXACT)); v4l2_info(sd, "Stopped: %s\n", - (i2c_rd16(sd, CSI_STATUS) & MASK_S_HLT) ? - "yes" : "no"); + str_yes_no(i2c_rd16(sd, CSI_STATUS) & MASK_S_HLT)); v4l2_info(sd, "Color space: %s\n", state->mbus_fmt_code == MEDIA_BUS_FMT_UYVY8_1X16 ? "YCbCr 422 16-bit" : @@ -1316,14 +1310,14 @@ static int tc358743_log_status(struct v4l2_subdev *sd) v4l2_info(sd, "-----%s status-----\n", is_hdmi(sd) ? "HDMI" : "DVI-D"); v4l2_info(sd, "HDCP encrypted content: %s\n", - hdmi_sys_status & MASK_S_HDCP ? "yes" : "no"); + str_yes_no(hdmi_sys_status & MASK_S_HDCP)); v4l2_info(sd, "Input color space: %s %s range\n", input_color_space[(vi_status3 & MASK_S_V_COLOR) >> 1], (vi_status3 & MASK_LIMITED) ? "limited" : "full"); if (!is_hdmi(sd)) return 0; - v4l2_info(sd, "AV Mute: %s\n", hdmi_sys_status & MASK_S_AVMUTE ? "on" : - "off"); + v4l2_info(sd, "AV Mute: %s\n", + str_on_off(hdmi_sys_status & MASK_S_AVMUTE)); v4l2_info(sd, "Deep color mode: %d-bits per channel\n", deep_color_mode[(i2c_rd8(sd, VI_STATUS1) & MASK_S_DEEPCOLOR) >> 2]);