From patchwork Mon Sep 30 12:04:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13816316 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 2F3A8CF64B1 for ; Mon, 30 Sep 2024 13:03:51 +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=GL1+Q9/ULYlU3CLmPIk9AVOdXWpb/NtMEppJq3PJtYk=; b=NGDl+0HCsp5W+oIayxFkYwCCBc 29y9GrpY33K+V5pAwzQw4gNX39iIU14j/Lmwg6UXlxnlGpokblUo7V740hlwoFBjnRpDI1Rcmjgeq +oytKs1CrFH2x1eumwnZ+T6wG2w5wnA2Ts39V9lm2Dj47jjTFez+wYkSaUXFRK1x+N/0D5Hdd2nlp yjQwkh4IEnZwHkP1N4XZ2q9iI/lIfGrPT5E5dx5KdRawSIFGGU/A1iCoEXPGC1cZJxn329ihNWbPG m8FvXd6XgXx+v5lNz54Z4JrA1P9gkXUCn1kNmhfdH8t/wgT7wzO8iGRyBmaBhJHu7UNH35MqM8D+7 lWRoSHcA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1svG3v-0000000HCAM-1PFz; Mon, 30 Sep 2024 13:03:39 +0000 Received: from mail-qv1-xf2a.google.com ([2607:f8b0:4864:20::f2a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1svF9c-0000000Gwlb-0yMx for linux-arm-kernel@lists.infradead.org; Mon, 30 Sep 2024 12:05:29 +0000 Received: by mail-qv1-xf2a.google.com with SMTP id 6a1803df08f44-6cb2f272f8bso40068746d6.0 for ; Mon, 30 Sep 2024 05:05:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1727697927; x=1728302727; 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=GL1+Q9/ULYlU3CLmPIk9AVOdXWpb/NtMEppJq3PJtYk=; b=hFOS0p+Y9Dt8r/WmhqmhTaTUksM1Te2OAsA7gZLDqSQQdHpRg8oIRfax3q1nfND+zE SVVrC9qHEdkKsCg9urysmvia+Sh6wHbLEeROG7LctUmm8vz9Yo8FfA9ejJNbzWalsRlq GuIVzLDMEuA1bE6ZBQ+ceSSwnTw/E0wZE9XoQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727697927; x=1728302727; 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=GL1+Q9/ULYlU3CLmPIk9AVOdXWpb/NtMEppJq3PJtYk=; b=xLOm7FtDth4Ir7VHiNRtPFQRYYT+Jh4Y8Ucr/Mp8gz3jzvUaDmtc3rMGAAD7WzlTZN Socm9YDnY+bjoJhpbbFw2wQUI65trK8Hg2omlbzrBdNvz1jskBxPsIfS6mnhbowuWDBB G+ZMvwt0W1bIUIAuG8me267ljMa9ZCpd9VJGUc8mIRqbGXqK+9LRL/eQZ7gP0G0V9abD gN/IhAdT16H/Gs+g/nV5GalloEefLcFFzRlEcMqjay4jcTJF4rLju35fZ8xXiFyJ+Jn3 41HIizb+wxQsrc8TEsfeoBor+WGB3ZrADtACUm/b1ssItkzd5X7IkKScLrEhsi/E8B5Y 7fTg== X-Forwarded-Encrypted: i=1; AJvYcCUxtoX3T3JwVwZBn9KM8GW27lKjDgpBIOB/xYABy+RZVOlthbMVclNSBFeEQMPjl06cFZE8BoPqThYuvtsPmQUO@lists.infradead.org X-Gm-Message-State: AOJu0YzSz0oHjIyc2tCVpOCix3qXRxxZqD+RaK6iKgIX7/X/dSZUhzMc us53O3dB6kBDEh/V5S+sDsM2J/OMknmVlWPV0ciPEfCycT/SXTwDXvIJYmKU9w== X-Google-Smtp-Source: AGHT+IG/6are8ci6AYDSQshUu34zjFa2sn9Z7jhsZeKvJuNj89zUt3QMjrvn9kvAxF3Mp7T2iyMvYw== X-Received: by 2002:a05:6214:5587:b0:6cb:3c08:30a0 with SMTP id 6a1803df08f44-6cb3c0830c5mr167635306d6.49.1727697927150; Mon, 30 Sep 2024 05:05:27 -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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 05:05:26 -0700 (PDT) From: Ricardo Ribalda Date: Mon, 30 Sep 2024 12:04:38 +0000 Subject: [PATCH 43/45] media: i2c: adv7842: Use string_choices helpers MIME-Version: 1.0 Message-Id: <20240930-cocci-opportunity-v1-43-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_050528_423895_BED275C4 X-CRM114-Status: GOOD ( 10.73 ) 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/adv7842.c:2761:5-29: opportunity for str_true_false(io_read ( sd , 0x6f ) & 0x01) drivers/media/i2c/adv7842.c:2754:5-29: opportunity for str_true_false(io_read ( sd , 0x6f ) & 0x02) drivers/media/i2c/adv7842.c:2821:3-31: opportunity for str_true_false(( hdmi_read ( sd , 0x05 ) & 0x40 )) drivers/media/i2c/adv7842.c:2763:5-31: opportunity for str_true_false(( io_read ( sd , 0x6a ) & 0x01 )) drivers/media/i2c/adv7842.c:2756:5-31: opportunity for str_true_false(( io_read ( sd , 0x6a ) & 0x02 )) drivers/media/i2c/adv7842.c:2765:5-31: opportunity for str_true_false(( io_read ( sd , 0x6a ) & 0x10 )) drivers/media/i2c/adv7842.c:2758:5-31: opportunity for str_true_false(( io_read ( sd , 0x6a ) & 0x20 )) drivers/media/i2c/adv7842.c:2736:4-22: opportunity for str_enabled_disabled(reg_io_0x21 & 0x01) drivers/media/i2c/adv7842.c:2735:4-22: opportunity for str_enabled_disabled(reg_io_0x21 & 0x02) drivers/media/i2c/adv7842.c:2737:28-51: opportunity for str_enabled_disabled(state -> cec_enabled_adap) drivers/media/i2c/adv7842.c:2812:4-24: opportunity for str_enabled_disabled(( reg_io_0x02 & 0x08 )) drivers/media/i2c/adv7842.c:2679:3-30: opportunity for str_enabled_disabled(( sdp_read ( sd , 0x12 ) & 0x08 )) drivers/media/i2c/adv7842.c:2730:4-52: opportunity for str_enabled_disabled(( ( reg_rep_0x7d & 0x04 ) && ( reg_rep_0x77 & 0x04 ) )) drivers/media/i2c/adv7842.c:2732:4-52: opportunity for str_enabled_disabled(( ( reg_rep_0x7d & 0x08 ) && ( reg_rep_0x77 & 0x08 ) )) drivers/media/i2c/adv7842.c:2768:5-33: opportunity for str_on_off(! ! ( cp_read ( sd , 0xff ) & 0x10 )) drivers/media/i2c/adv7842.c:2843:3-31: opportunity for str_on_off(( hdmi_read ( sd , 0x04 ) & 0x40 )) drivers/media/i2c/adv7842.c:2654:2-29: opportunity for str_on_off(( sdp_read ( sd , 0x56 ) & 0x01 )) drivers/media/i2c/adv7842.c:2823:3-31: opportunity for str_yes_no(( hdmi_read ( sd , 0x04 ) & 0x20 )) Signed-off-by: Ricardo Ribalda --- drivers/media/i2c/adv7842.c | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c index 014fc913225c..a43479c3ff03 100644 --- a/drivers/media/i2c/adv7842.c +++ b/drivers/media/i2c/adv7842.c @@ -2651,7 +2651,7 @@ static int adv7842_sdp_log_status(struct v4l2_subdev *sd) io_read(sd, 0x01) & 0x0f, io_read(sd, 0x00) & 0x3f); v4l2_info(sd, "SDP: free run: %s\n", - (sdp_read(sd, 0x56) & 0x01) ? "on" : "off"); + str_on_off(sdp_read(sd, 0x56) & 0x01)); v4l2_info(sd, "SDP: %s\n", sdp_signal_detected ? "valid SD/PR signal detected" : "invalid/no signal"); if (sdp_signal_detected) { @@ -2676,7 +2676,7 @@ static int adv7842_sdp_log_status(struct v4l2_subdev *sd) v4l2_info(sd, "SDP: %s\n", (sdp_read(sd, 0x57) & 0x08) ? "Interlaced" : "Progressive"); v4l2_info(sd, "SDP: deinterlacer %s\n", - (sdp_read(sd, 0x12) & 0x08) ? "enabled" : "disabled"); + str_enabled_disabled(sdp_read(sd, 0x12) & 0x08)); v4l2_info(sd, "SDP: csc %s mode\n", (sdp_io_read(sd, 0xe0) & 0x40) ? "auto" : "manual"); } @@ -2727,15 +2727,13 @@ static int adv7842_cp_log_status(struct v4l2_subdev *sd) v4l2_info(sd, "HDMI/DVI-D port selected: %s\n", state->hdmi_port_a ? "A" : "B"); v4l2_info(sd, "EDID A %s, B %s\n", - ((reg_rep_0x7d & 0x04) && (reg_rep_0x77 & 0x04)) ? - "enabled" : "disabled", - ((reg_rep_0x7d & 0x08) && (reg_rep_0x77 & 0x08)) ? - "enabled" : "disabled"); + str_enabled_disabled((reg_rep_0x7d & 0x04) && (reg_rep_0x77 & 0x04)), + str_enabled_disabled((reg_rep_0x7d & 0x08) && (reg_rep_0x77 & 0x08))); v4l2_info(sd, "HPD A %s, B %s\n", - reg_io_0x21 & 0x02 ? "enabled" : "disabled", - reg_io_0x21 & 0x01 ? "enabled" : "disabled"); - v4l2_info(sd, "CEC: %s\n", state->cec_enabled_adap ? - "enabled" : "disabled"); + str_enabled_disabled(reg_io_0x21 & 0x02), + str_enabled_disabled(reg_io_0x21 & 0x01)); + v4l2_info(sd, "CEC: %s\n", + str_enabled_disabled(state->cec_enabled_adap)); if (state->cec_enabled_adap) { int i; @@ -2751,21 +2749,21 @@ static int adv7842_cp_log_status(struct v4l2_subdev *sd) v4l2_info(sd, "-----Signal status-----\n"); if (state->hdmi_port_a) { v4l2_info(sd, "Cable detected (+5V power): %s\n", - io_read(sd, 0x6f) & 0x02 ? "true" : "false"); + str_true_false(io_read(sd, 0x6f) & 0x02)); v4l2_info(sd, "TMDS signal detected: %s\n", - (io_read(sd, 0x6a) & 0x02) ? "true" : "false"); + str_true_false(io_read(sd, 0x6a) & 0x02)); v4l2_info(sd, "TMDS signal locked: %s\n", - (io_read(sd, 0x6a) & 0x20) ? "true" : "false"); + str_true_false(io_read(sd, 0x6a) & 0x20)); } else { v4l2_info(sd, "Cable detected (+5V power):%s\n", - io_read(sd, 0x6f) & 0x01 ? "true" : "false"); + str_true_false(io_read(sd, 0x6f) & 0x01)); v4l2_info(sd, "TMDS signal detected: %s\n", - (io_read(sd, 0x6a) & 0x01) ? "true" : "false"); + str_true_false(io_read(sd, 0x6a) & 0x01)); v4l2_info(sd, "TMDS signal locked: %s\n", - (io_read(sd, 0x6a) & 0x10) ? "true" : "false"); + str_true_false(io_read(sd, 0x6a) & 0x10)); } v4l2_info(sd, "CP free run: %s\n", - (!!(cp_read(sd, 0xff) & 0x10) ? "on" : "off")); + str_on_off(cp_read(sd, 0xff) & 0x10)); v4l2_info(sd, "Prim-mode = 0x%x, video std = 0x%x, v_freq = 0x%x\n", io_read(sd, 0x01) & 0x0f, io_read(sd, 0x00) & 0x3f, (io_read(sd, 0x01) & 0x70) >> 4); @@ -2809,7 +2807,7 @@ static int adv7842_cp_log_status(struct v4l2_subdev *sd) (reg_io_0x02 & 0x02) ? "RGB" : "YCbCr", (((reg_io_0x02 >> 2) & 0x01) ^ (reg_io_0x02 & 0x01)) ? "(16-235)" : "(0-255)", - (reg_io_0x02 & 0x08) ? "enabled" : "disabled"); + str_enabled_disabled(reg_io_0x02 & 0x08)); v4l2_info(sd, "Color space conversion: %s\n", csc_coeff_sel_rb[cp_read(sd, 0xf4) >> 4]); @@ -2818,9 +2816,9 @@ static int adv7842_cp_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_read(sd, 0x05) & 0x40) ? "true" : "false"); + str_true_false(hdmi_read(sd, 0x05) & 0x40)); v4l2_info(sd, "HDCP keys read: %s%s\n", - (hdmi_read(sd, 0x04) & 0x20) ? "yes" : "no", + str_yes_no(hdmi_read(sd, 0x04) & 0x20), (hdmi_read(sd, 0x04) & 0x10) ? "ERROR" : ""); if (!is_hdmi(sd)) return 0; @@ -2840,7 +2838,7 @@ static int adv7842_cp_log_status(struct v4l2_subdev *sd) (hdmi_read(sd, 0x5e) << 8) + hdmi_read(sd, 0x5f)); v4l2_info(sd, "AV Mute: %s\n", - (hdmi_read(sd, 0x04) & 0x40) ? "on" : "off"); + str_on_off(hdmi_read(sd, 0x04) & 0x40)); v4l2_info(sd, "Deep color mode: %s\n", deep_color_mode_txt[hdmi_read(sd, 0x0b) >> 6]);