From nobody Thu Nov 28 15:41:26 2024 Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7830C18E04D for ; Mon, 30 Sep 2024 12:04:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727697845; cv=none; b=ks02JxDWMKkoUMQsgcY9iPC8un0c2raQLIL2NJsks5+SRbOQguXa6PSfv1hxeCQeOjCm8XLs0gpUFFULjDACkl1h3C5eIjJsbaecdREAegj3Ix+nmNXTCJPG4hk7yonLcEGU4BjK23y1z7bfEmJCnWr/adcjjjuvj929CDabI4s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727697845; c=relaxed/simple; bh=GKbZYjpKrXM02bqB7G1Yq07NRfmowulZwrzkIvqCt4I=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=G4m2T+NxbDwPENwpKIVfhxlnvm0tYtAarAStT5C6tX3l/kc/cbgYLXGVdkTy7TJDdl1Pnoig2QIuV5IRTK5x1Ba7hdVGndcevgsFIH9V/wuMpTeBxHEcW2n5h0tyY7zdr06lsatsKvSnq5cDeqigi4WeBvWsDO07eevbcpf+ObU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=LbRde610; arc=none smtp.client-ip=209.85.219.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="LbRde610" Received: by mail-qv1-f43.google.com with SMTP id 6a1803df08f44-6cb2c5128d5so31318636d6.0 for ; Mon, 30 Sep 2024 05:04:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1727697841; x=1728302641; darn=vger.kernel.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=/5VgfIVfz1YgxOOgFfrYzixq0Bnk4fhK8m8Ic5VNHEI=; b=LbRde610YSp3nB2FMFuKK3hooXKZEkEbnvDCAa22wXshjPlFVKnkDHczFYnj918DOF xL+CpIjfWkCIyJ08W6TUyV9jk6Cp+pIeCE0cK5AbVqEe+8jxvEOsvV5wY5UvdQ3+683u LRUifxqOlHBjOjuz9RRzETOFJ0LeDMkKi7l34= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727697841; x=1728302641; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/5VgfIVfz1YgxOOgFfrYzixq0Bnk4fhK8m8Ic5VNHEI=; b=jimfIiASym2nK6p4kAn/8YsNxJa17gFkcFLFJUu9iJbzN4c2raBVPlrGYdRjIb2oAq S3jTTk9VPeywQagtCxsA/4JHpgwXqwLiVkezeqsKS/dnKZ/VNYJfqSoFow9557WQ3gHF 9M1+hcWTZe3v6zOt27kvV5j1Wv4oBMeUH6khr002S+1W8cN1hRVPvdNpt9Q0Y0RD/xdB GWREYjmxdzqobOOM4vkuydcLzdwGaI4axYkOKyMxOV/X0m6u5EK+R97HiJXtEDyoaLww fmKI3u01ITU9fzgWwyyTJtX2LcTwA8eEu//x+9bW6iWMV0qjnQty/qimmQauSp8i4UbT bJGQ== X-Forwarded-Encrypted: i=1; AJvYcCU2+qPduumo3jYkSxti+yM5C5QmdCkpA7sKYAVzpcHvCGWQxCqvzdZB+P7IlTucxlwO8l8JzscuzSlDzC8=@vger.kernel.org X-Gm-Message-State: AOJu0YxYNVx9kQm5Tcv+S1nMj2MlpjRHZhVfPtZS5/pSSmD5PqvJHxeC 80/CO7mTgtvKaIFS5vwdaW6S7q3rH+ljg6qMLchZCASbqVR1GfQ9fYHYjCrfBg== X-Google-Smtp-Source: AGHT+IEkkoZ77UVe1HBseRyAv4Z3HJ6VkOYoXbNi44RuV9k8F46CRfqyvbe5oQOx55Ew0ldDus/+TA== X-Received: by 2002:a05:6214:4306:b0:6c6:9bb9:b435 with SMTP id 6a1803df08f44-6cb3b64c231mr158464086d6.53.1727697841211; Mon, 30 Sep 2024 05:04:01 -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.03.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 05:04:00 -0700 (PDT) From: Ricardo Ribalda Subject: [PATCH 00/45] media: Use string_choice helpers Date: Mon, 30 Sep 2024 12:03:55 +0000 Message-Id: <20240930-cocci-opportunity-v1-0-81e137456ce0@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-B4-Tracking: v=1; b=H4sIAKyT+mYC/x3MQQqAIBBA0avErBPUpKirRAubppqNiloU0d2Tl m/x/wOJIlOCoXog0smJvStQdQW4W7eR4KUYtNRG9o0U6BFZ+BB8zIfjfAsjZ7StVR0aDaULkVa +/uc4ve8H7bQ6S2MAAAA= 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?Niklas_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 include/linux/string_choices.h contains a set of helpers that can be used instead of hard coding some strings. Cocci has located some places where the helpers can be used. This patchset uses the diff generated by cocci, plus these changes: diff --git a/drivers/media/dvb-frontends/ascot2e.c b/drivers/media/dvb-fron= tends/ascot2e.c index 8c3eb5d69dda..ec7a718428fc 100644 --- a/drivers/media/dvb-frontends/ascot2e.c +++ b/drivers/media/dvb-frontends/ascot2e.c @@ -104,7 +104,7 @@ static void ascot2e_i2c_debug(struct ascot2e_priv *priv, u8 reg, u8 write, const u8 *data, u32 len) { dev_dbg(&priv->i2c->dev, "ascot2e: I2C %s reg 0x%02x size %d\n", - str_read_write(write =3D=3D 0), reg, len); + str_write_read(write), reg, len); print_hex_dump_bytes("ascot2e: I2C data: ", DUMP_PREFIX_OFFSET, data, len); } diff --git a/drivers/media/dvb-frontends/cxd2841er.c b/drivers/media/dvb-fr= ontends/cxd2841er.c index db684f314b47..d1b84cd9c510 100644 --- a/drivers/media/dvb-frontends/cxd2841er.c +++ b/drivers/media/dvb-frontends/cxd2841er.c @@ -206,7 +206,7 @@ static void cxd2841er_i2c_debug(struct cxd2841er_priv *= priv, { dev_dbg(&priv->i2c->dev, "cxd2841er: I2C %s addr %02x reg 0x%02x size %d data %*ph\n= ", - str_read_write(write =3D=3D 0), addr, reg, len, len, data); + str_write_read(write), addr, reg, len, len, data); } =20 static int cxd2841er_write_regs(struct cxd2841er_priv *priv, diff --git a/drivers/media/dvb-frontends/helene.c b/drivers/media/dvb-front= ends/helene.c index 52198cb49dba..b4527c141d9c 100644 --- a/drivers/media/dvb-frontends/helene.c +++ b/drivers/media/dvb-frontends/helene.c @@ -279,7 +279,7 @@ static void helene_i2c_debug(struct helene_priv *priv, u8 reg, u8 write, const u8 *data, u32 len) { dev_dbg(&priv->i2c->dev, "helene: I2C %s reg 0x%02x size %d\n", - str_read_write(write =3D=3D 0), reg, len); + str_write_read(write), reg, len); print_hex_dump_bytes("helene: I2C data: ", DUMP_PREFIX_OFFSET, data, len); } diff --git a/drivers/media/dvb-frontends/horus3a.c b/drivers/media/dvb-fron= tends/horus3a.c index 84385079918c..10300ebf3ca0 100644 --- a/drivers/media/dvb-frontends/horus3a.c +++ b/drivers/media/dvb-frontends/horus3a.c @@ -38,7 +38,7 @@ static void horus3a_i2c_debug(struct horus3a_priv *priv, u8 reg, u8 write, const u8 *data, u32 len) { dev_dbg(&priv->i2c->dev, "horus3a: I2C %s reg 0x%02x size %d\n", - str_read_write(write =3D=3D 0), reg, len); + str_write_read(write), reg, len); print_hex_dump_bytes("horus3a: I2C data: ", DUMP_PREFIX_OFFSET, data, len); } diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c index ba174aa45afa..a43479c3ff03 100644 --- a/drivers/media/i2c/adv7842.c +++ b/drivers/media/i2c/adv7842.c @@ -2763,7 +2763,7 @@ static int adv7842_cp_log_status(struct v4l2_subdev *= sd) str_true_false(io_read(sd, 0x6a) & 0x10)); } v4l2_info(sd, "CP free run: %s\n", - str_on_off(!!(cp_read(sd, 0xff) & 0x10))); + str_on_off(cp_read(sd, 0xff) & 0x10)); v4l2_info(sd, "Prim-mode =3D 0x%x, video std =3D 0x%x, v_freq =3D 0= x%x\n", io_read(sd, 0x01) & 0x0f, io_read(sd, 0x00) & 0x3f, (io_read(sd, 0x01) & 0x70) >> 4); diff --git a/drivers/media/pci/saa7134/saa7134-cards.c b/drivers/media/pci/= saa7134/saa7134-cards.c index 301b89e799d8..79cd61fb0205 100644 --- a/drivers/media/pci/saa7134/saa7134-cards.c +++ b/drivers/media/pci/saa7134/saa7134-cards.c @@ -7981,7 +7981,7 @@ int saa7134_board_init2(struct saa7134_dev *dev) rc =3D i2c_transfer(&dev->i2c_adap, &msg, 1); pr_info("%s: probe IR chip @ i2c 0x%02x: %s\n", dev->name, msg.addr, - str_yes_no(1 =3D=3D rc)); + str_yes_no(rc =3D=3D 1)); if (rc =3D=3D 1) dev->has_remote =3D SAA7134_REMOTE_I2C; } diff --git a/drivers/media/pci/saa7134/saa7134-input.c b/drivers/media/pci/= saa7134/saa7134-input.c index 90837ec6e70f..239f0b9d080a 100644 --- a/drivers/media/pci/saa7134/saa7134-input.c +++ b/drivers/media/pci/saa7134/saa7134-input.c @@ -895,7 +895,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) rc =3D i2c_transfer(&dev->i2c_adap, &msg_msi, 1); input_dbg("probe 0x%02x @ %s: %s\n", msg_msi.addr, dev->i2c_adap.name, - str_yes_no(1 =3D=3D rc)); + str_yes_no(rc =3D=3D 1)); break; case SAA7134_BOARD_SNAZIO_TVPVR_PRO: dev->init_data.name =3D "SnaZio* TVPVR PRO"; @@ -931,7 +931,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) rc =3D i2c_transfer(&dev->i2c_adap, &msg_msi, 1); input_dbg("probe 0x%02x @ %s: %s\n", msg_msi.addr, dev->i2c_adap.name, - str_yes_no(1 =3D=3D rc)); + str_yes_no(rc =3D=3D 1)); break; case SAA7134_BOARD_HAUPPAUGE_HVR1110: dev->init_data.name =3D saa7134_boards[dev->board].name; diff --git a/drivers/media/usb/pvrusb2/pvrusb2-ctrl.c b/drivers/media/usb/p= vrusb2/pvrusb2-ctrl.c index 448c40caf363..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 *c= ptr, *len =3D scnprintf(buf,maxlen,"%d",val); ret =3D 0; } else if (cptr->info->type =3D=3D pvr2_ctl_bool) { - *len =3D scnprintf(buf,maxlen,"%s",str_true_false(val)); + *len =3D scnprintf(buf, maxlen, "%s", str_true_false(val)); ret =3D 0; } else if (cptr->info->type =3D=3D pvr2_ctl_enum) { const char * const *names; diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pv= rusb2/pvrusb2-hdw.c index 96d3a0045fac..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,str_true_false(val)); + name, str_true_false(val)); } Signed-off-by: Ricardo Ribalda --- Ricardo Ribalda (45): media: staging: ipu3: Use string_choices helpers media: staging: atomisp: Use string_choices helpers media: core: Use string_choices helpers media: pwc-ctl: Use string_choices helpers media: pvrusb2:Use string_choices helpers media: em28xx: Use string_choices helpers media: dvb-usb: Use string_choices helpers media: dvb-usb-v2: Use string_choices helpers media: cx231xx: Use string_choices helpers media: tuners: Use string_choices helpers media: rc: Use string_choices helpers media: dvb-frontends: Use string_choices helpers media: pci: cx23885: Use string_choices helpers media: saa7134: Use string_choices helpers media: amphion: Use string_choices helpers media: pci: ivtv: Use string_choices helpers media: bttv: Use string_choices helpers media: xilinx: Use string_choices helpers media: platform: ti: Use string_choices helpers media: st: Use string_choices helpers media: coda: Use string_choices helpers media: aspeed: Use string_choices helpers media: ipu6: Use string_choices helpers media: cx18: Use string_choices helpers media: cobalt: Use string_choices helpers media: videobuf2: Use string_choices helpers media: cec: Use string_choices helpers media: b2c2: Use string_choices helpers media: siano: Use string_choices helpers media: i2c: cx25840: Use string_choices helpers media: i2c: vpx3220: Use string_choices helpers media: i2c: tvp7002: Use string_choices helpers media: i2c: ths8200: Use string_choices helpers media: i2c: tda1997x: Use string_choices helpers media: i2c: tc358743: Use string_choices helpers media: i2c: st-mipid02: Use string_choices helpers media: i2c: msp3400: Use string_choices helpers media: i2c: max9286: Use string_choices helpers media: i2c: saa717x: Use string_choices helpers media: i2c: saa7127: Use string_choices helpers media: i2c: saa7115: Use string_choices helpers media: i2c: saa7110: Use string_choices helpers media: i2c: adv7842: Use string_choices helpers media: i2c: adv76xx: Use string_choices helpers media: i2c: adv7511: Use string_choices helpers drivers/media/cec/platform/cec-gpio/cec-gpio.c | 4 +- drivers/media/cec/usb/pulse8/pulse8-cec.c | 4 +- drivers/media/common/b2c2/flexcop-hw-filter.c | 4 +- drivers/media/common/siano/sms-cards.c | 3 +- drivers/media/common/videobuf2/videobuf2-core.c | 5 ++- drivers/media/dvb-frontends/ascot2e.c | 2 +- drivers/media/dvb-frontends/cx24120.c | 4 +- drivers/media/dvb-frontends/cxd2841er.c | 2 +- drivers/media/dvb-frontends/drxk_hard.c | 4 +- drivers/media/dvb-frontends/helene.c | 2 +- drivers/media/dvb-frontends/horus3a.c | 2 +- drivers/media/dvb-frontends/sp2.c | 2 +- drivers/media/i2c/adv7511-v4l2.c | 11 +++--- drivers/media/i2c/adv7604.c | 25 ++++++------ drivers/media/i2c/adv7842.c | 40 ++++++++++--------= -- drivers/media/i2c/cx25840/cx25840-core.c | 4 +- drivers/media/i2c/cx25840/cx25840-ir.c | 34 ++++++++--------- drivers/media/i2c/max9286.c | 2 +- drivers/media/i2c/msp3400-driver.c | 4 +- drivers/media/i2c/saa7110.c | 2 +- drivers/media/i2c/saa7115.c | 2 +- drivers/media/i2c/saa7127.c | 15 +++++--- drivers/media/i2c/saa717x.c | 2 +- drivers/media/i2c/st-mipid02.c | 2 +- drivers/media/i2c/tc358743.c | 44 ++++++++++--------= ---- drivers/media/i2c/tda1997x.c | 6 +-- drivers/media/i2c/ths8200.c | 4 +- drivers/media/i2c/tvp7002.c | 2 +- drivers/media/i2c/vpx3220.c | 2 +- drivers/media/pci/bt8xx/bttv-cards.c | 16 ++++---- drivers/media/pci/bt8xx/bttv-driver.c | 6 +-- drivers/media/pci/cobalt/cobalt-driver.c | 2 +- drivers/media/pci/cx18/cx18-av-core.c | 4 +- drivers/media/pci/cx23885/altera-ci.c | 2 +- drivers/media/pci/cx23885/cimax2.c | 2 +- drivers/media/pci/cx23885/cx23888-ir.c | 36 +++++++++--------- drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c | 2 +- drivers/media/pci/ivtv/ivtvfb.c | 4 +- drivers/media/pci/saa7134/saa7134-cards.c | 2 +- drivers/media/pci/saa7134/saa7134-dvb.c | 2 +- drivers/media/pci/saa7134/saa7134-input.c | 6 +-- drivers/media/pci/saa7134/saa7134-video.c | 2 +- drivers/media/platform/amphion/venc.c | 2 +- drivers/media/platform/amphion/vpu_dbg.c | 2 +- drivers/media/platform/aspeed/aspeed-video.c | 4 +- drivers/media/platform/chips-media/coda/imx-vdoa.c | 3 +- drivers/media/platform/st/sti/hva/hva-debugfs.c | 6 +-- drivers/media/platform/ti/omap3isp/ispstat.c | 2 +- drivers/media/platform/xilinx/xilinx-csi2rxss.c | 18 ++++----- drivers/media/rc/ene_ir.c | 3 +- drivers/media/rc/mceusb.c | 3 +- drivers/media/rc/serial_ir.c | 5 ++- drivers/media/tuners/tda18250.c | 2 +- drivers/media/tuners/tda9887.c | 10 ++--- drivers/media/usb/cx231xx/cx231xx-i2c.c | 4 +- drivers/media/usb/cx231xx/cx231xx-video.c | 2 +- drivers/media/usb/dvb-usb-v2/az6007.c | 4 +- drivers/media/usb/dvb-usb-v2/dvb_usb_core.c | 4 +- drivers/media/usb/dvb-usb/af9005-fe.c | 4 +- drivers/media/usb/dvb-usb/dvb-usb-dvb.c | 6 +-- drivers/media/usb/dvb-usb/opera1.c | 8 ++-- drivers/media/usb/em28xx/em28xx-i2c.c | 4 +- drivers/media/usb/em28xx/em28xx-video.c | 2 +- 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 +- drivers/media/usb/pwc/pwc-ctrl.c | 2 +- drivers/media/v4l2-core/v4l2-ctrls-core.c | 3 +- drivers/media/v4l2-core/v4l2-fwnode.c | 12 +++--- .../media/atomisp/pci/atomisp_compat_css20.c | 2 +- .../media/atomisp/pci/atomisp_csi2_bridge.c | 2 +- .../media/atomisp/pci/atomisp_gmin_platform.c | 4 +- drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 4 +- .../media/atomisp/pci/runtime/binary/src/binary.c | 2 +- drivers/staging/media/atomisp/pci/sh_css.c | 2 +- drivers/staging/media/ipu3/ipu3-v4l2.c | 4 +- 78 files changed, 240 insertions(+), 239 deletions(-) --- base-commit: 9852d85ec9d492ebef56dc5f229416c925758edc change-id: 20240930-cocci-opportunity-40bca6a17c42 Best regards, --=20 Ricardo Ribalda