From patchwork Mon Sep 30 12:04:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13816049 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 D6E00CF6497 for ; Mon, 30 Sep 2024 12:11:39 +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=Vb+rHfycpw6eqzxAcjL5Q/NM2Cf8FBszS0leZkajSd4=; b=oMuP4D+Sy0ELZUqtSNhJU7wR+C oY/0Lam0QzN2ZyxTVDRvs3TVwxCKb+Xb7zcqW69f4uYOhg4OZXA8R868dkt6fjelZD96qUCQP1b8s bFBTnG9RULSd+tVFchlJ41d9GlwsMmIMPyzgK7Ou42z1EBVmr05elw55kCp7Pc3LWrn+AZ2aVMbyv NeNP5tyAUZTNLv/Vg1yJBp8XdIIDxrJC3GMXmbhZIiR6lrD62HismQI5DqvkuMwzQ9nbNxXlHjPHb PRlDNq+8hSOGTKRlSWvWO9Y/eiJzzMaBDwZB9vNaIEpodlNbRLjLmPRba2Tqn45BF8nbkJ3GRaB50 UMUx2MKw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1svFFS-0000000GyFS-3dss; Mon, 30 Sep 2024 12:11:30 +0000 Received: from mail-qk1-x72e.google.com ([2607:f8b0:4864:20::72e]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1svF8Q-0000000GwBg-455w for linux-arm-kernel@lists.infradead.org; Mon, 30 Sep 2024 12:04:16 +0000 Received: by mail-qk1-x72e.google.com with SMTP id af79cd13be357-7a9a30a045cso419780885a.2 for ; Mon, 30 Sep 2024 05:04:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1727697853; x=1728302653; 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=Vb+rHfycpw6eqzxAcjL5Q/NM2Cf8FBszS0leZkajSd4=; b=d5Zq1jqAI7x6HgNm2kGZfyTZSdIMmEINreUbqZGMc8Pa6qZSnzGvLjH+v1TeA4Qx2r Wv6JwG5cQHhl6XtCrMKnlcPF38DS9I7pDtohUNgUj8hoL2QmyeDO9xyr775K75EKWAXH kREPey68zmzehlxGhm+GVBAUJjZzA4Jjx5BQ8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727697853; x=1728302653; 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=Vb+rHfycpw6eqzxAcjL5Q/NM2Cf8FBszS0leZkajSd4=; b=HNnVBMw1PJY9bsOFi08pS/XA5GjAU5OCSwlFdK5Isk7XYM72qVxWb69z4lxtRqHPhE SQrwarCTLg3e6JXe7LHaqXRtANEXMbeG5vlTboi9c8LgqA4I4fQvtkO8RM0aazr1SGc+ WnV5deCGbOhZjtSRkrXLmMZjK1LZcMlk32o3R8dy1JSeMFivEI/1NCkS99ff+H9Jm2MI 7gdKrkw0h6SwK4VYWksNrJIh5d2lyss3svfTtt3/P6HI+w9HAIch7EfLc/rv9nHukWZ3 /LhsVlNHE00qTqYaL6mDWd9VB7XBhmgxJISSoCvqNq9DaJBFb+l+gHz9TK4rZStycAFp he8g== X-Forwarded-Encrypted: i=1; AJvYcCWMa/3bYUcwM1oeL0w9fPCZsFAyJc+o9hrZYWYTmCkUBKc6axI8VcNCeCX20nIMHGrhWihpO6qxJYUXa5jxbCF3@lists.infradead.org X-Gm-Message-State: AOJu0Yy8puL4xFqCtogQVXq4BbdkQ6s3i6tvmv/XEAca8DtI4qg7zDdC SZD/gQDJDdR5m2gveYAu46t1bw/XUCz13tCBE1qwXSqEopXTAzg2xpWm30xvwQ== X-Google-Smtp-Source: AGHT+IERK7kGfru4Q7d82RuyPjgoS6CBbu4N/h9Q+YkCupy/y3EuDtqtjn9iCQgLe1Tq04yD8BYOEQ== X-Received: by 2002:a05:6214:4a8e:b0:6c5:5418:a055 with SMTP id 6a1803df08f44-6cb3b5f2781mr194666026d6.30.1727697853291; Mon, 30 Sep 2024 05:04: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.04.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 05:04:12 -0700 (PDT) From: Ricardo Ribalda Date: Mon, 30 Sep 2024 12:04:00 +0000 Subject: [PATCH 05/45] media: pvrusb2:Use string_choices helpers MIME-Version: 1.0 Message-Id: <20240930-cocci-opportunity-v1-5-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_050415_061715_24CDAF4A X-CRM114-Status: GOOD ( 15.68 ) 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/usb/pvrusb2/pvrusb2-hdw.c:341:11-14: opportunity for str_true_false(val) drivers/media/usb/pvrusb2/pvrusb2-hdw.c:1727:6-17: opportunity for str_enable_disable(enable_flag) drivers/media/usb/pvrusb2/pvrusb2-hdw.c:1663:6-14: opportunity for str_on_off(enablefl) drivers/media/usb/pvrusb2/pvrusb2-encoder.c:265:8-29: opportunity for str_true_false(hdw -> state_encoder_ok) drivers/media/usb/pvrusb2/pvrusb2-encoder.c:271:9-33: opportunity for str_true_false(hdw -> state_encoder_runok) drivers/media/usb/pvrusb2/pvrusb2-ctrl.c:524:35-38: opportunity for str_true_false(val) drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c:475:11-37: opportunity for str_read_write(msgs [ idx ] . flags & I2C_M_RD) drivers/media/usb/pvrusb2/pvrusb2-debugifc.c:151:4-31: opportunity for str_on_off(pvr2_hdw_get_streaming ( hdw )) Signed-off-by: Ricardo Ribalda --- drivers/media/usb/pvrusb2/pvrusb2-ctrl.c | 2 +- drivers/media/usb/pvrusb2/pvrusb2-debugifc.c | 3 ++- drivers/media/usb/pvrusb2/pvrusb2-encoder.c | 5 ++--- drivers/media/usb/pvrusb2/pvrusb2-hdw.c | 6 +++--- drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c | 3 +-- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/media/usb/pvrusb2/pvrusb2-ctrl.c b/drivers/media/usb/pvrusb2/pvrusb2-ctrl.c index 8ae3ad80cccb..b6c9bda214c8 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-ctrl.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-ctrl.c @@ -521,7 +521,7 @@ int pvr2_ctrl_value_to_sym_internal(struct pvr2_ctrl *cptr, *len = scnprintf(buf,maxlen,"%d",val); ret = 0; } else if (cptr->info->type == pvr2_ctl_bool) { - *len = scnprintf(buf,maxlen,"%s",val ? "true" : "false"); + *len = scnprintf(buf, maxlen, "%s", str_true_false(val)); ret = 0; } else if (cptr->info->type == pvr2_ctl_enum) { const char * const *names; diff --git a/drivers/media/usb/pvrusb2/pvrusb2-debugifc.c b/drivers/media/usb/pvrusb2/pvrusb2-debugifc.c index 81d711269ab5..9e4eb03133c9 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-debugifc.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-debugifc.c @@ -5,6 +5,7 @@ */ #include +#include #include "pvrusb2-debugifc.h" #include "pvrusb2-hdw.h" #include "pvrusb2-debug.h" @@ -148,7 +149,7 @@ int pvr2_debugifc_print_status(struct pvr2_hdw *hdw, bcnt += ccnt; acnt -= ccnt; buf += ccnt; ccnt = scnprintf(buf,acnt,"Streaming is %s\n", - pvr2_hdw_get_streaming(hdw) ? "on" : "off"); + str_on_off(pvr2_hdw_get_streaming(hdw))); bcnt += ccnt; acnt -= ccnt; buf += ccnt; diff --git a/drivers/media/usb/pvrusb2/pvrusb2-encoder.c b/drivers/media/usb/pvrusb2/pvrusb2-encoder.c index c8102772344b..8a2464744e5b 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-encoder.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-encoder.c @@ -262,14 +262,13 @@ rdData[0]); pvr2_trace(PVR2_TRACE_STBITS, "State bit %s <-- %s", "state_encoder_ok", - (hdw->state_encoder_ok ? "true" : "false")); + str_true_false(hdw->state_encoder_ok)); if (hdw->state_encoder_runok) { hdw->state_encoder_runok = 0; pvr2_trace(PVR2_TRACE_STBITS, "State bit %s <-- %s", "state_encoder_runok", - (hdw->state_encoder_runok ? - "true" : "false")); + str_true_false(hdw->state_encoder_runok)); } pvr2_trace( PVR2_TRACE_ERROR_LEGS, diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c index 29cc207194b9..761d718478ca 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c @@ -338,7 +338,7 @@ static void trace_stbit(const char *name,int val) { pvr2_trace(PVR2_TRACE_STBITS, "State bit %s <-- %s", - name,(val ? "true" : "false")); + name, str_true_false(val)); } static int ctrl_channelfreq_get(struct pvr2_ctrl *cptr,int *vp) @@ -1660,7 +1660,7 @@ static int pvr2_decoder_enable(struct pvr2_hdw *hdw,int enablefl) anyway, just in case somebody else wants to hear the command... */ pvr2_trace(PVR2_TRACE_CHIPS, "subdev v4l2 stream=%s", - (enablefl ? "on" : "off")); + str_on_off(enablefl)); v4l2_device_call_all(&hdw->v4l2_dev, 0, video, s_stream, enablefl); v4l2_device_call_all(&hdw->v4l2_dev, 0, audio, s_stream, enablefl); if (hdw->decoder_client_id) { @@ -1724,7 +1724,7 @@ int pvr2_hdw_set_streaming(struct pvr2_hdw *hdw,int enable_flag) hdw->state_pipeline_req = enable_flag != 0; pvr2_trace(PVR2_TRACE_START_STOP, "/*--TRACE_STREAM--*/ %s", - enable_flag ? "enable" : "disable"); + str_enable_disable(enable_flag)); } pvr2_hdw_state_sched(hdw); LOCK_GIVE(hdw->big_lock); diff --git a/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c index 63db04fe12d3..60a0df018334 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c @@ -472,8 +472,7 @@ static int pvr2_i2c_xfer(struct i2c_adapter *i2c_adap, idx+1,num, msgs[idx].addr, cnt, - (msgs[idx].flags & I2C_M_RD ? - "read" : "write")); + str_read_write(msgs[idx].flags & I2C_M_RD)); if ((ret > 0) || !(msgs[idx].flags & I2C_M_RD)) { if (cnt > 8) cnt = 8; pr_cont(" [");