From patchwork Mon Sep 30 12:04:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13816320 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 DECB1CF64B1 for ; Mon, 30 Sep 2024 13:05:05 +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=NEpH3GW+zX127Rx2gWkJapzmZ8AtweIcRQ6dozRhT1Y=; b=izdMoDNqyqMyeLxr2qxdUg2k08 iOZMZTa9NANZgB8LFVLLJ+ey80jTQEb3H55ImRgBVI8HbgUYapoFl8FcZwmt3M/A6q4zQuc6McRbu TiDnQ2D96a/IvkzRUfahJMKTzwlCk0uJnAJ1kUnMSff9u+zrf3TcWY98/dA8FP7g9XsYkgwmIdgkB h2bLje8tAXXQP0hHXTN5oQHHW77zv6E11ftEQyQAUK2SnIOKqm5Kk0VTSTwZ3Hfr8stBNuOYfstFK EqS6IXGJ5vaKkme/CKiysGhDzQkZYFFPxvzI1cpjM7zBgKsrw57ahWji2eqwFeyb054G2sJutkz8l mzi1w+Kg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1svG55-0000000HCMA-3d0W; Mon, 30 Sep 2024 13:04:51 +0000 Received: from mail-qk1-x72d.google.com ([2607:f8b0:4864:20::72d]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1svF9e-0000000Gwmv-0l8d for linux-arm-kernel@lists.infradead.org; Mon, 30 Sep 2024 12:05:31 +0000 Received: by mail-qk1-x72d.google.com with SMTP id af79cd13be357-7a9af813f6cso405675285a.3 for ; Mon, 30 Sep 2024 05:05:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1727697929; x=1728302729; 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=NEpH3GW+zX127Rx2gWkJapzmZ8AtweIcRQ6dozRhT1Y=; b=YI7Fn0TD+5qIoF26eIECTpua56VcOM5WzE5A0HQKU5hU/jPXxysntYx2yQWX55Cb4z HzrwY1T01XYEhlK0Ylj1kWjtrKmEqmicCFNvBnwq3TI9RYBVQFWHbYR1sCDXk6qzPknt pg9HNsZ7E1774kyxEgziNbAHmGazBMT3q9UUs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727697929; x=1728302729; 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=NEpH3GW+zX127Rx2gWkJapzmZ8AtweIcRQ6dozRhT1Y=; b=kGGWBy+7lJoLKczcakXjVAmT+O5PM6l2qr1F67sJtMM+IZuQ/A+yTFyJ7AN06ULCAf WVTKCNvwsdCTM7VZ2KCtkIT8+ixSYP35yk746P2bBQxoupJ9Ayf3Zyba4d2L0qJ3sIVB xNk4klqFYoN+x/JrLgBDdba4WqYxqD7fHGc/SwVaip61zJw9Dijtq3NnG0X7wvfpcEMV pKX7kf1nv1q7WEGm976v/RH8rU/eR0ivd+360qDXosmT8k9ZUhL0bL/zCv+AGgwnk73+ 98tEO5oDzn+bwhEOWOS8xUV63MUUJoHNxnVZpzKphkQNXt/c9e3/BJTob6BL95aucgca SFMQ== X-Forwarded-Encrypted: i=1; AJvYcCVKFTi7uD4lARP04Y+T/RVuawM1NFjHEEAxgTLL/oLg3QZUDWuUok6IOAY8YchPfsIA/dE+8noUOhDmyL7hMMXh@lists.infradead.org X-Gm-Message-State: AOJu0YxSrWvDBAelnkpNcqs8vXZXWrwBxjhwr8vEZfceRvEOBH0NH5R4 rPKO8OiE239cGjhzkzI279UZSsRBI22gaHW9DOnllW3kOV1AS+GhtrN2WRGi0Q== X-Google-Smtp-Source: AGHT+IFPaIZM1NSUWS2N20Z229u6ehVGSu/pXbG6WOauy86M5vVJLdj9bB3eMmf2b81ROre6rRHWmQ== X-Received: by 2002:a05:6214:3207:b0:6c5:7446:4fdf with SMTP id 6a1803df08f44-6cb3b5e283dmr198571366d6.24.1727697929145; Mon, 30 Sep 2024 05:05:29 -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.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 05:05:28 -0700 (PDT) From: Ricardo Ribalda Date: Mon, 30 Sep 2024 12:04:39 +0000 Subject: [PATCH 44/45] media: i2c: adv76xx: Use string_choices helpers MIME-Version: 1.0 Message-Id: <20240930-cocci-opportunity-v1-44-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_050530_267274_C17D61DE X-CRM114-Status: GOOD ( 10.87 ) 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/adv7604.c:2641:3-31: opportunity for str_true_false(( hdmi_read ( sd , 0x05 ) & 0x40 )) drivers/media/i2c/adv7604.c:2595:34-48: opportunity for str_false_true(no_lock_cp ( sd )) drivers/media/i2c/adv7604.c:2593:36-52: opportunity for str_false_true(no_lock_sspd ( sd )) drivers/media/i2c/adv7604.c:2594:36-52: opportunity for str_false_true(no_lock_stdi ( sd )) drivers/media/i2c/adv7604.c:2592:3-19: opportunity for str_false_true(no_lock_tmds ( sd )) drivers/media/i2c/adv7604.c:2590:3-21: opportunity for str_false_true(no_signal_tmds ( sd )) drivers/media/i2c/adv7604.c:2568:28-51: opportunity for str_enabled_disabled(state -> cec_enabled_adap) drivers/media/i2c/adv7604.c:2630:3-23: opportunity for str_enabled_disabled(( reg_io_0x02 & 0x08 )) drivers/media/i2c/adv7604.c:2597:3-20: opportunity for str_on_off(( in_free_run ( sd ) )) drivers/media/i2c/adv7604.c:2664:33-61: opportunity for str_on_off(( hdmi_read ( sd , 0x04 ) & 0x40 )) drivers/media/i2c/adv7604.c:2643:3-31: opportunity for str_yes_no(( hdmi_read ( sd , 0x04 ) & 0x20 )) Signed-off-by: Ricardo Ribalda --- drivers/media/i2c/adv7604.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 48230d5109f0..fb74f2947413 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -2565,8 +2565,8 @@ static int adv76xx_log_status(struct v4l2_subdev *sd) ((edid_enabled & 0x02) ? "Yes" : "No"), ((edid_enabled & 0x04) ? "Yes" : "No"), ((edid_enabled & 0x08) ? "Yes" : "No")); - v4l2_info(sd, "CEC: %s\n", state->cec_enabled_adap ? - "enabled" : "disabled"); + v4l2_info(sd, "CEC: %s\n", + str_enabled_disabled(state->cec_enabled_adap)); if (state->cec_enabled_adap) { int i; @@ -2587,14 +2587,14 @@ static int adv76xx_log_status(struct v4l2_subdev *sd) ((cable_det & 0x04) ? "Yes" : "No"), ((cable_det & 0x08) ? "Yes" : "No")); v4l2_info(sd, "TMDS signal detected: %s\n", - no_signal_tmds(sd) ? "false" : "true"); + str_false_true(no_signal_tmds(sd))); v4l2_info(sd, "TMDS signal locked: %s\n", - no_lock_tmds(sd) ? "false" : "true"); - v4l2_info(sd, "SSPD locked: %s\n", no_lock_sspd(sd) ? "false" : "true"); - v4l2_info(sd, "STDI locked: %s\n", no_lock_stdi(sd) ? "false" : "true"); - v4l2_info(sd, "CP locked: %s\n", no_lock_cp(sd) ? "false" : "true"); + str_false_true(no_lock_tmds(sd))); + v4l2_info(sd, "SSPD locked: %s\n", str_false_true(no_lock_sspd(sd))); + v4l2_info(sd, "STDI locked: %s\n", str_false_true(no_lock_stdi(sd))); + v4l2_info(sd, "CP locked: %s\n", str_false_true(no_lock_cp(sd))); v4l2_info(sd, "CP free run: %s\n", - (in_free_run(sd)) ? "on" : "off"); + str_on_off(in_free_run(sd))); 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); @@ -2627,7 +2627,7 @@ static int adv76xx_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, info->cp_csc) >> 4]); @@ -2638,9 +2638,9 @@ static int adv76xx_log_status(struct v4l2_subdev *sd) v4l2_info(sd, "Digital video port selected: %c\n", (hdmi_read(sd, 0x00) & 0x03) + 'A'); 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)) { bool audio_pll_locked = hdmi_read(sd, 0x04) & 0x01; @@ -2661,7 +2661,8 @@ static int adv76xx_log_status(struct v4l2_subdev *sd) v4l2_info(sd, "Audio N: %u\n", ((hdmi_read(sd, 0x5d) & 0x0f) << 16) + (hdmi_read(sd, 0x5e) << 8) + hdmi_read(sd, 0x5f)); - v4l2_info(sd, "AV Mute: %s\n", (hdmi_read(sd, 0x04) & 0x40) ? "on" : "off"); + v4l2_info(sd, "AV Mute: %s\n", + str_on_off(hdmi_read(sd, 0x04) & 0x40)); v4l2_info(sd, "Deep color mode: %s\n", deep_color_mode_txt[(hdmi_read(sd, 0x0b) & 0x60) >> 5]); v4l2_info(sd, "HDMI colorspace: %s\n", hdmi_color_space_txt[hdmi_read(sd, 0x53) & 0xf]);