From patchwork Mon Sep 30 12:04:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13816237 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 7BB54CF6499 for ; Mon, 30 Sep 2024 12:37:45 +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=Ebt+1b/55aPXlqauBXJO18wSUl/XzTUjhH2wTMyzrFA=; b=BlDwKLOMzIXiK3NsMbMgKelbzF /rA32g9ms0EHftHs6fH+YmNKSkOow102k0qiwcu8ZqoQo2j22AOAYnCH4kRu3QmwZ9WprCC5jT/jn 6F3uE3DIWhmaUGqrgq7J6BsYU+gElg2t/hTdyS+9uzmfS/oZDHCabyy8L5pCCydjIApC/JzEI5q8R PMhsdMYHZoRiUtDE6TNgoNA+osiCXe+uRrysveB6LPSsBWVEJNCrfAngkxKPG7y89sNqMsVlRj8wm 5T8vWQtYQPcZmPV8PvHu0ejTS1EGJtbiGpvzmn7enCf6v8/FUq6eNm9SIgKItoOC7Un+X/F+2qaNA iJwqtz0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1svFef-0000000H54i-43yC; Mon, 30 Sep 2024 12:37:33 +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 1svF9F-0000000Gwan-2qFw for linux-arm-kernel@lists.infradead.org; Mon, 30 Sep 2024 12:05:06 +0000 Received: by mail-qv1-xf34.google.com with SMTP id 6a1803df08f44-6cb2aaf4a73so45116046d6.2 for ; Mon, 30 Sep 2024 05:05:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1727697905; x=1728302705; 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=Ebt+1b/55aPXlqauBXJO18wSUl/XzTUjhH2wTMyzrFA=; b=exc55GRcJVnIqJwpX25R9AFhBfc2YjGnEHBw2zLCBaeqyrhHwzueGQijuJUC+iNXKs tGOUn88CP1ZXR0AS/UOyiubD3u38LLQZgmDvjqB1RtFnU7lH8/xS4je/GtZJaCS38d4Y 4kp7iZv1iamTQGPf3IKo2IK/8Hwp+rgebJ6HQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727697905; x=1728302705; 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=Ebt+1b/55aPXlqauBXJO18wSUl/XzTUjhH2wTMyzrFA=; b=rWddHnWWrKLiErl/Kz3Bxc4YnjoFdBElQoFRmvdMokhJpJdugL22a6sqlAIbA/kZeH VHJQ/H//8efKy+wv5jRhhglcEW21p+LmuUndGhgAmZUjFNQg4KQYc9fUxA5mqlINlh2p RGehumrW3sfNwQH/anCZmsBPtpC6d0P7JctncdkTU2GDlzM1WxIEa+n94KS1l74Qafeb v8Fux+XKlz/EYTJSt9p5NbyGuUBAOv+QTecmsIsDADrZ+pASDkr+UcdJiCIpf8EFoyc0 2BKP4cufTOKwWsGk83P35WLD+KvaRDyuva4DiMkzgWtV9AMqPa+DrzMbqkuQV+5RL9ye 20vg== X-Forwarded-Encrypted: i=1; AJvYcCUHJ87ErPiQOpf1CV2qsMI+MxZn72b79qZNQe2uzIe5XjTFFRVY24CCWfit89hk8ze3+Y8D+RF/i31DpziIIm3E@lists.infradead.org X-Gm-Message-State: AOJu0YyNLayOrS2EYTWGLo6K3/Gr0kPHUnJWBY8qnRwI6eug8vevvsgc lswmB9P+ZMZZRMuL48oglX41Rx8L2xMj7Yd+Mh1ZMpi+IFL8khrxQezZ0TluPA== X-Google-Smtp-Source: AGHT+IG7DxsLwmOc7mkRl/MFKW8HAXRHroSnhiAWX2HVxDFuz0PGg7dWtpjL7qcJseQqckH9Ha41Tg== X-Received: by 2002:a05:6214:448c:b0:6c1:8663:e8f0 with SMTP id 6a1803df08f44-6cb3b61465amr169180096d6.28.1727697904581; Mon, 30 Sep 2024 05:05:04 -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.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 05:05:04 -0700 (PDT) From: Ricardo Ribalda Date: Mon, 30 Sep 2024 12:04:25 +0000 Subject: [PATCH 30/45] media: i2c: cx25840: Use string_choices helpers MIME-Version: 1.0 Message-Id: <20240930-cocci-opportunity-v1-30-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_050505_764198_49A5AF5E X-CRM114-Status: GOOD ( 12.95 ) 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/cx25840/cx25840-ir.c:1089:4-9: opportunity for str_enabled_disabled(filtr) drivers/media/i2c/cx25840/cx25840-ir.c:1028:4-21: opportunity for str_enabled_disabled(cntrl & CNTRL_DMD) drivers/media/i2c/cx25840/cx25840-ir.c:1113:4-21: opportunity for str_enabled_disabled(cntrl & CNTRL_MOD) drivers/media/i2c/cx25840/cx25840-ir.c:1030:4-21: opportunity for str_enabled_disabled(cntrl & CNTRL_RFE) drivers/media/i2c/cx25840/cx25840-ir.c:1115:4-21: opportunity for str_enabled_disabled(cntrl & CNTRL_TFE) drivers/media/i2c/cx25840/cx25840-ir.c:1101:4-21: opportunity for str_enabled_disabled(irqen & IRQEN_ROE) drivers/media/i2c/cx25840/cx25840-ir.c:1107:4-21: opportunity for str_enabled_disabled(irqen & IRQEN_RSE) drivers/media/i2c/cx25840/cx25840-ir.c:1097:4-21: opportunity for str_enabled_disabled(irqen & IRQEN_RTE) drivers/media/i2c/cx25840/cx25840-ir.c:1135:4-21: opportunity for str_enabled_disabled(irqen & IRQEN_TSE) drivers/media/i2c/cx25840/cx25840-ir.c:1026:4-21: opportunity for str_yes_no(cntrl & CNTRL_RXE) drivers/media/i2c/cx25840/cx25840-ir.c:1111:4-21: opportunity for str_yes_no(cntrl & CNTRL_TXE) drivers/media/i2c/cx25840/cx25840-ir.c:1103:4-21: opportunity for str_yes_no(stats & STATS_RBY) drivers/media/i2c/cx25840/cx25840-ir.c:1099:4-21: opportunity for str_yes_no(stats & STATS_ROR) drivers/media/i2c/cx25840/cx25840-ir.c:1105:4-21: opportunity for str_yes_no(stats & STATS_RSR) drivers/media/i2c/cx25840/cx25840-ir.c:1095:4-21: opportunity for str_yes_no(stats & STATS_RTO) drivers/media/i2c/cx25840/cx25840-ir.c:1131:4-21: opportunity for str_yes_no(stats & STATS_TBY) drivers/media/i2c/cx25840/cx25840-ir.c:1133:4-21: opportunity for str_yes_no(stats & STATS_TSR) drivers/media/i2c/cx25840/cx25840-core.c:2369:2-8: opportunity for str_enable_disable(enable) drivers/media/i2c/cx25840/cx25840-core.c:2392:2-8: opportunity for str_enable_disable(enable) Signed-off-by: Ricardo Ribalda --- drivers/media/i2c/cx25840/cx25840-core.c | 4 ++-- drivers/media/i2c/cx25840/cx25840-ir.c | 34 ++++++++++++++++---------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/media/i2c/cx25840/cx25840-core.c b/drivers/media/i2c/cx25840/cx25840-core.c index a90a9e5705a0..dd8474609092 100644 --- a/drivers/media/i2c/cx25840/cx25840-core.c +++ b/drivers/media/i2c/cx25840/cx25840-core.c @@ -2366,7 +2366,7 @@ static int cx25840_s_audio_stream(struct v4l2_subdev *sd, int enable) return 0; v4l_dbg(1, cx25840_debug, client, "%s audio output\n", - enable ? "enable" : "disable"); + str_enable_disable(enable)); if (enable) { v = cx25840_read(client, 0x115) | 0x80; @@ -2389,7 +2389,7 @@ static int cx25840_s_stream(struct v4l2_subdev *sd, int enable) u8 v; v4l_dbg(1, cx25840_debug, client, "%s video output\n", - enable ? "enable" : "disable"); + str_enable_disable(enable)); /* * It's not clear what should be done for these devices. diff --git a/drivers/media/i2c/cx25840/cx25840-ir.c b/drivers/media/i2c/cx25840/cx25840-ir.c index 8cef9656c612..6f3978135178 100644 --- a/drivers/media/i2c/cx25840/cx25840-ir.c +++ b/drivers/media/i2c/cx25840/cx25840-ir.c @@ -1023,11 +1023,11 @@ int cx25840_ir_log_status(struct v4l2_subdev *sd) v4l2_info(sd, "IR Receiver:\n"); v4l2_info(sd, "\tEnabled: %s\n", - cntrl & CNTRL_RXE ? "yes" : "no"); + str_yes_no(cntrl & CNTRL_RXE)); v4l2_info(sd, "\tDemodulation from a carrier: %s\n", - cntrl & CNTRL_DMD ? "enabled" : "disabled"); + str_enabled_disabled(cntrl & CNTRL_DMD)); v4l2_info(sd, "\tFIFO: %s\n", - cntrl & CNTRL_RFE ? "enabled" : "disabled"); + str_enabled_disabled(cntrl & CNTRL_RFE)); switch (cntrl & CNTRL_EDG) { case CNTRL_EDG_NONE: s = "disabled"; @@ -1086,33 +1086,33 @@ int cx25840_ir_log_status(struct v4l2_subdev *sd) pulse_width_count_to_us(FIFO_RXTX, rxclk), pulse_width_count_to_ns(FIFO_RXTX, rxclk)); v4l2_info(sd, "\tLow pass filter: %s\n", - filtr ? "enabled" : "disabled"); + str_enabled_disabled(filtr)); if (filtr) v4l2_info(sd, "\tMin acceptable pulse width (LPF): %u us, %u ns\n", lpf_count_to_us(filtr), lpf_count_to_ns(filtr)); v4l2_info(sd, "\tPulse width timer timed-out: %s\n", - stats & STATS_RTO ? "yes" : "no"); + str_yes_no(stats & STATS_RTO)); v4l2_info(sd, "\tPulse width timer time-out intr: %s\n", - irqen & IRQEN_RTE ? "enabled" : "disabled"); + str_enabled_disabled(irqen & IRQEN_RTE)); v4l2_info(sd, "\tFIFO overrun: %s\n", - stats & STATS_ROR ? "yes" : "no"); + str_yes_no(stats & STATS_ROR)); v4l2_info(sd, "\tFIFO overrun interrupt: %s\n", - irqen & IRQEN_ROE ? "enabled" : "disabled"); + str_enabled_disabled(irqen & IRQEN_ROE)); v4l2_info(sd, "\tBusy: %s\n", - stats & STATS_RBY ? "yes" : "no"); + str_yes_no(stats & STATS_RBY)); v4l2_info(sd, "\tFIFO service requested: %s\n", - stats & STATS_RSR ? "yes" : "no"); + str_yes_no(stats & STATS_RSR)); v4l2_info(sd, "\tFIFO service request interrupt: %s\n", - irqen & IRQEN_RSE ? "enabled" : "disabled"); + str_enabled_disabled(irqen & IRQEN_RSE)); v4l2_info(sd, "IR Transmitter:\n"); v4l2_info(sd, "\tEnabled: %s\n", - cntrl & CNTRL_TXE ? "yes" : "no"); + str_yes_no(cntrl & CNTRL_TXE)); v4l2_info(sd, "\tModulation onto a carrier: %s\n", - cntrl & CNTRL_MOD ? "enabled" : "disabled"); + str_enabled_disabled(cntrl & CNTRL_MOD)); v4l2_info(sd, "\tFIFO: %s\n", - cntrl & CNTRL_TFE ? "enabled" : "disabled"); + str_enabled_disabled(cntrl & CNTRL_TFE)); v4l2_info(sd, "\tFIFO interrupt watermark: %s\n", cntrl & CNTRL_TIC ? "not empty" : "half full or less"); v4l2_info(sd, "\tCarrier polarity: %s\n", @@ -1128,11 +1128,11 @@ int cx25840_ir_log_status(struct v4l2_subdev *sd) pulse_width_count_to_us(FIFO_RXTX, txclk), pulse_width_count_to_ns(FIFO_RXTX, txclk)); v4l2_info(sd, "\tBusy: %s\n", - stats & STATS_TBY ? "yes" : "no"); + str_yes_no(stats & STATS_TBY)); v4l2_info(sd, "\tFIFO service requested: %s\n", - stats & STATS_TSR ? "yes" : "no"); + str_yes_no(stats & STATS_TSR)); v4l2_info(sd, "\tFIFO service request interrupt: %s\n", - irqen & IRQEN_TSE ? "enabled" : "disabled"); + str_enabled_disabled(irqen & IRQEN_TSE)); return 0; }