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(-)
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-frontends/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 == 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-frontends/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 == 0), addr, reg, len, len, data);
+ str_write_read(write), addr, reg, len, len, data);
}
static int cxd2841er_write_regs(struct cxd2841er_priv *priv,
diff --git a/drivers/media/dvb-frontends/helene.c b/drivers/media/dvb-frontends/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 == 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-frontends/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 == 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 = 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);
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 = 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 == rc));
+ str_yes_no(rc == 1));
if (rc == 1)
dev->has_remote = 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 = 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 == rc));
+ str_yes_no(rc == 1));
break;
case SAA7134_BOARD_SNAZIO_TVPVR_PRO:
dev->init_data.name = "SnaZio* TVPVR PRO";
@@ -931,7 +931,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev)
rc = 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 == rc));
+ str_yes_no(rc == 1));
break;
case SAA7134_BOARD_HAUPPAUGE_HVR1110:
dev->init_data.name = saa7134_boards[dev->board].name;
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-ctrl.c b/drivers/media/usb/pvrusb2/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 *cptr,
*len = scnprintf(buf,maxlen,"%d",val);
ret = 0;
} else if (cptr->info->type == pvr2_ctl_bool) {
- *len = scnprintf(buf,maxlen,"%s",str_true_false(val));
+ *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-hdw.c b/drivers/media/usb/pvrusb2/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 <ribalda@chromium.org>
---
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,
--
Ricardo Ribalda <ribalda@chromium.org>
Hi Ricardo, On Mon, Sep 30, 2024 at 12:03:55PM +0000, Ricardo Ribalda wrote: > 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: Personally I think most of those helpers just hinder readability for not much added gain. String de-duplication is done by the linker already. The only value I see in the helpers is ensuring that the strings are consistently written, and I think we can do so through other means. > diff --git a/drivers/media/dvb-frontends/ascot2e.c b/drivers/media/dvb-frontends/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 == 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-frontends/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 == 0), addr, reg, len, len, data); > + str_write_read(write), addr, reg, len, len, data); > } > > static int cxd2841er_write_regs(struct cxd2841er_priv *priv, > diff --git a/drivers/media/dvb-frontends/helene.c b/drivers/media/dvb-frontends/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 == 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-frontends/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 == 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 = 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); > 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 = 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 == rc)); > + str_yes_no(rc == 1)); > if (rc == 1) > dev->has_remote = 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 = 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 == rc)); > + str_yes_no(rc == 1)); > break; > case SAA7134_BOARD_SNAZIO_TVPVR_PRO: > dev->init_data.name = "SnaZio* TVPVR PRO"; > @@ -931,7 +931,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) > rc = 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 == rc)); > + str_yes_no(rc == 1)); > break; > case SAA7134_BOARD_HAUPPAUGE_HVR1110: > dev->init_data.name = saa7134_boards[dev->board].name; > diff --git a/drivers/media/usb/pvrusb2/pvrusb2-ctrl.c b/drivers/media/usb/pvrusb2/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 *cptr, > *len = scnprintf(buf,maxlen,"%d",val); > ret = 0; > } else if (cptr->info->type == pvr2_ctl_bool) { > - *len = scnprintf(buf,maxlen,"%s",str_true_false(val)); > + *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-hdw.c b/drivers/media/usb/pvrusb2/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 <ribalda@chromium.org> > --- > 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 -- Regards, Laurent Pinchart
On 30/09/2024 14:21, Laurent Pinchart wrote: > Hi Ricardo, > > On Mon, Sep 30, 2024 at 12:03:55PM +0000, Ricardo Ribalda wrote: >> 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: > > Personally I think most of those helpers just hinder readability for not > much added gain. String de-duplication is done by the linker already. > The only value I see in the helpers is ensuring that the strings are > consistently written, and I think we can do so through other means. Just my opinion: I'm OK with these new helpers, but I am not too keen to apply all this to existing source code. I.e., for new code it is fine, but if we have to update all drivers every time a new cocci test is added, then that will not scale. Note that I never ran cocci in my build scripts, so this is a new check that we haven't set rules for or have much experience with. checkpatch just checks the patches, it doesn't force you to fix existing code. Some of the cocci tests are clearly checking for incorrect code, but others are for code improvements (i.e. the code was correct, it can just be done slightly better). It's the second category were I think that should only apply to new code, and not existing code. Regards, Hans > >> diff --git a/drivers/media/dvb-frontends/ascot2e.c b/drivers/media/dvb-frontends/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 == 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-frontends/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 == 0), addr, reg, len, len, data); >> + str_write_read(write), addr, reg, len, len, data); >> } >> >> static int cxd2841er_write_regs(struct cxd2841er_priv *priv, >> diff --git a/drivers/media/dvb-frontends/helene.c b/drivers/media/dvb-frontends/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 == 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-frontends/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 == 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 = 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); >> 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 = 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 == rc)); >> + str_yes_no(rc == 1)); >> if (rc == 1) >> dev->has_remote = 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 = 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 == rc)); >> + str_yes_no(rc == 1)); >> break; >> case SAA7134_BOARD_SNAZIO_TVPVR_PRO: >> dev->init_data.name = "SnaZio* TVPVR PRO"; >> @@ -931,7 +931,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) >> rc = 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 == rc)); >> + str_yes_no(rc == 1)); >> break; >> case SAA7134_BOARD_HAUPPAUGE_HVR1110: >> dev->init_data.name = saa7134_boards[dev->board].name; >> diff --git a/drivers/media/usb/pvrusb2/pvrusb2-ctrl.c b/drivers/media/usb/pvrusb2/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 *cptr, >> *len = scnprintf(buf,maxlen,"%d",val); >> ret = 0; >> } else if (cptr->info->type == pvr2_ctl_bool) { >> - *len = scnprintf(buf,maxlen,"%s",str_true_false(val)); >> + *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-hdw.c b/drivers/media/usb/pvrusb2/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 <ribalda@chromium.org> >> --- >> 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 >
On Mon, Sep 30, 2024 at 9:38 PM Hans Verkuil <hverkuil@xs4all.nl> wrote: > > On 30/09/2024 14:21, Laurent Pinchart wrote: > > Hi Ricardo, > > > > On Mon, Sep 30, 2024 at 12:03:55PM +0000, Ricardo Ribalda wrote: > >> 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: > > > > Personally I think most of those helpers just hinder readability for not > > much added gain. String de-duplication is done by the linker already. > > The only value I see in the helpers is ensuring that the strings are > > consistently written, and I think we can do so through other means. > > Just my opinion: I'm OK with these new helpers, but I am not too keen to apply > all this to existing source code. I.e., for new code it is fine, but if we have > to update all drivers every time a new cocci test is added, then that will not > scale. +1 for avoiding applying this to existing code. It will just make it more difficult to backport changes to stable kernels because of meaningless conflicts. Best, Tomasz > > Note that I never ran cocci in my build scripts, so this is a new check that > we haven't set rules for or have much experience with. > > checkpatch just checks the patches, it doesn't force you to fix existing code. > > Some of the cocci tests are clearly checking for incorrect code, but others are > for code improvements (i.e. the code was correct, it can just be done slightly > better). It's the second category were I think that should only apply to new code, > and not existing code. > > Regards, > > Hans > > > > >> diff --git a/drivers/media/dvb-frontends/ascot2e.c b/drivers/media/dvb-frontends/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 == 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-frontends/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 == 0), addr, reg, len, len, data); > >> + str_write_read(write), addr, reg, len, len, data); > >> } > >> > >> static int cxd2841er_write_regs(struct cxd2841er_priv *priv, > >> diff --git a/drivers/media/dvb-frontends/helene.c b/drivers/media/dvb-frontends/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 == 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-frontends/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 == 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 = 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); > >> 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 = 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 == rc)); > >> + str_yes_no(rc == 1)); > >> if (rc == 1) > >> dev->has_remote = 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 = 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 == rc)); > >> + str_yes_no(rc == 1)); > >> break; > >> case SAA7134_BOARD_SNAZIO_TVPVR_PRO: > >> dev->init_data.name = "SnaZio* TVPVR PRO"; > >> @@ -931,7 +931,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) > >> rc = 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 == rc)); > >> + str_yes_no(rc == 1)); > >> break; > >> case SAA7134_BOARD_HAUPPAUGE_HVR1110: > >> dev->init_data.name = saa7134_boards[dev->board].name; > >> diff --git a/drivers/media/usb/pvrusb2/pvrusb2-ctrl.c b/drivers/media/usb/pvrusb2/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 *cptr, > >> *len = scnprintf(buf,maxlen,"%d",val); > >> ret = 0; > >> } else if (cptr->info->type == pvr2_ctl_bool) { > >> - *len = scnprintf(buf,maxlen,"%s",str_true_false(val)); > >> + *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-hdw.c b/drivers/media/usb/pvrusb2/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 <ribalda@chromium.org> > >> --- > >> 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 > > >
On Mon, 30 Sept 2024 at 14:38, Hans Verkuil <hverkuil@xs4all.nl> wrote: > > On 30/09/2024 14:21, Laurent Pinchart wrote: > > Hi Ricardo, > > > > On Mon, Sep 30, 2024 at 12:03:55PM +0000, Ricardo Ribalda wrote: > >> 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: > > > > Personally I think most of those helpers just hinder readability for not > > much added gain. String de-duplication is done by the linker already. > > The only value I see in the helpers is ensuring that the strings are > > consistently written, and I think we can do so through other means. > > Just my opinion: I'm OK with these new helpers, but I am not too keen to apply > all this to existing source code. I.e., for new code it is fine, but if we have > to update all drivers every time a new cocci test is added, then that will not > scale. > > Note that I never ran cocci in my build scripts, so this is a new check that > we haven't set rules for or have much experience with. > > checkpatch just checks the patches, it doesn't force you to fix existing code. > > Some of the cocci tests are clearly checking for incorrect code, but others are > for code improvements (i.e. the code was correct, it can just be done slightly > better). It's the second category were I think that should only apply to new code, > and not existing code. > > Regards, Julia, correct me if I am wrong, but I believe that cocci does not have the ability to check only new code. It runs against files not diffs. I agree with you, a "improvement cocci" shall not force us to drop the pen and work full time to fix it :) When a new "improvement" cocci check is landed, we should update our "allowlist" immediately to ignore those warnings until we slowly improve our codebase to meet the standard. That way the CI is not affected. Regarding this patchset.... It is pretty big, but also pretty simple. I added my "extra changes" on the cover letter to ease the review. If you or someone else have time to review it... then it will be great if we land it. But if none has time for it, then it can be ignored. Regards! > > Hans > > > > >> diff --git a/drivers/media/dvb-frontends/ascot2e.c b/drivers/media/dvb-frontends/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 == 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-frontends/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 == 0), addr, reg, len, len, data); > >> + str_write_read(write), addr, reg, len, len, data); > >> } > >> > >> static int cxd2841er_write_regs(struct cxd2841er_priv *priv, > >> diff --git a/drivers/media/dvb-frontends/helene.c b/drivers/media/dvb-frontends/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 == 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-frontends/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 == 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 = 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); > >> 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 = 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 == rc)); > >> + str_yes_no(rc == 1)); > >> if (rc == 1) > >> dev->has_remote = 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 = 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 == rc)); > >> + str_yes_no(rc == 1)); > >> break; > >> case SAA7134_BOARD_SNAZIO_TVPVR_PRO: > >> dev->init_data.name = "SnaZio* TVPVR PRO"; > >> @@ -931,7 +931,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) > >> rc = 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 == rc)); > >> + str_yes_no(rc == 1)); > >> break; > >> case SAA7134_BOARD_HAUPPAUGE_HVR1110: > >> dev->init_data.name = saa7134_boards[dev->board].name; > >> diff --git a/drivers/media/usb/pvrusb2/pvrusb2-ctrl.c b/drivers/media/usb/pvrusb2/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 *cptr, > >> *len = scnprintf(buf,maxlen,"%d",val); > >> ret = 0; > >> } else if (cptr->info->type == pvr2_ctl_bool) { > >> - *len = scnprintf(buf,maxlen,"%s",str_true_false(val)); > >> + *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-hdw.c b/drivers/media/usb/pvrusb2/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 <ribalda@chromium.org> > >> --- > >> 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 > > > -- Ricardo Ribalda
On Mon, 30 Sep 2024, Ricardo Ribalda wrote: > On Mon, 30 Sept 2024 at 14:38, Hans Verkuil <hverkuil@xs4all.nl> wrote: > > > > On 30/09/2024 14:21, Laurent Pinchart wrote: > > > Hi Ricardo, > > > > > > On Mon, Sep 30, 2024 at 12:03:55PM +0000, Ricardo Ribalda wrote: > > >> 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: > > > > > > Personally I think most of those helpers just hinder readability for not > > > much added gain. String de-duplication is done by the linker already. > > > The only value I see in the helpers is ensuring that the strings are > > > consistently written, and I think we can do so through other means. > > > > Just my opinion: I'm OK with these new helpers, but I am not too keen to apply > > all this to existing source code. I.e., for new code it is fine, but if we have > > to update all drivers every time a new cocci test is added, then that will not > > scale. > > > > Note that I never ran cocci in my build scripts, so this is a new check that > > we haven't set rules for or have much experience with. > > > > checkpatch just checks the patches, it doesn't force you to fix existing code. > > > > Some of the cocci tests are clearly checking for incorrect code, but others are > > for code improvements (i.e. the code was correct, it can just be done slightly > > better). It's the second category were I think that should only apply to new code, > > and not existing code. > > > > Regards, > > Julia, correct me if I am wrong, but I believe that cocci does not > have the ability to check only new code. It runs against files not > diffs. Coccinelle runs on files normally. There is an option --use-patch-diff where you can give a commit id, and it should only work on the files mentioned in that commit, but it doesn't seem to focus on only the new code in that commit. julia > > I agree with you, a "improvement cocci" shall not force us to drop the > pen and work full time to fix it :) > When a new "improvement" cocci check is landed, we should update our > "allowlist" immediately to ignore those warnings until we slowly > improve our codebase to meet the standard. > That way the CI is not affected. > > Regarding this patchset.... It is pretty big, but also pretty simple. > I added my "extra changes" on the cover letter to ease the review. > > If you or someone else have time to review it... then it will be great > if we land it. But if none has time for it, then it can be ignored. > > > Regards! > > > > > Hans > > > > > > > >> diff --git a/drivers/media/dvb-frontends/ascot2e.c b/drivers/media/dvb-frontends/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 == 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-frontends/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 == 0), addr, reg, len, len, data); > > >> + str_write_read(write), addr, reg, len, len, data); > > >> } > > >> > > >> static int cxd2841er_write_regs(struct cxd2841er_priv *priv, > > >> diff --git a/drivers/media/dvb-frontends/helene.c b/drivers/media/dvb-frontends/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 == 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-frontends/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 == 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 = 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); > > >> 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 = 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 == rc)); > > >> + str_yes_no(rc == 1)); > > >> if (rc == 1) > > >> dev->has_remote = 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 = 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 == rc)); > > >> + str_yes_no(rc == 1)); > > >> break; > > >> case SAA7134_BOARD_SNAZIO_TVPVR_PRO: > > >> dev->init_data.name = "SnaZio* TVPVR PRO"; > > >> @@ -931,7 +931,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) > > >> rc = 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 == rc)); > > >> + str_yes_no(rc == 1)); > > >> break; > > >> case SAA7134_BOARD_HAUPPAUGE_HVR1110: > > >> dev->init_data.name = saa7134_boards[dev->board].name; > > >> diff --git a/drivers/media/usb/pvrusb2/pvrusb2-ctrl.c b/drivers/media/usb/pvrusb2/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 *cptr, > > >> *len = scnprintf(buf,maxlen,"%d",val); > > >> ret = 0; > > >> } else if (cptr->info->type == pvr2_ctl_bool) { > > >> - *len = scnprintf(buf,maxlen,"%s",str_true_false(val)); > > >> + *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-hdw.c b/drivers/media/usb/pvrusb2/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 <ribalda@chromium.org> > > >> --- > > >> 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 > > > > > > > > -- > Ricardo Ribalda >
Hi Julia, On 30/09/2024 16:36, Julia Lawall wrote: > > > On Mon, 30 Sep 2024, Ricardo Ribalda wrote: > >> On Mon, 30 Sept 2024 at 14:38, Hans Verkuil <hverkuil@xs4all.nl> wrote: >>> >>> On 30/09/2024 14:21, Laurent Pinchart wrote: >>>> Hi Ricardo, >>>> >>>> On Mon, Sep 30, 2024 at 12:03:55PM +0000, Ricardo Ribalda wrote: >>>>> 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: >>>> >>>> Personally I think most of those helpers just hinder readability for not >>>> much added gain. String de-duplication is done by the linker already. >>>> The only value I see in the helpers is ensuring that the strings are >>>> consistently written, and I think we can do so through other means. >>> >>> Just my opinion: I'm OK with these new helpers, but I am not too keen to apply >>> all this to existing source code. I.e., for new code it is fine, but if we have >>> to update all drivers every time a new cocci test is added, then that will not >>> scale. >>> >>> Note that I never ran cocci in my build scripts, so this is a new check that >>> we haven't set rules for or have much experience with. >>> >>> checkpatch just checks the patches, it doesn't force you to fix existing code. >>> >>> Some of the cocci tests are clearly checking for incorrect code, but others are >>> for code improvements (i.e. the code was correct, it can just be done slightly >>> better). It's the second category were I think that should only apply to new code, >>> and not existing code. >>> >>> Regards, >> >> Julia, correct me if I am wrong, but I believe that cocci does not >> have the ability to check only new code. It runs against files not >> diffs. > > Coccinelle runs on files normally. There is an option --use-patch-diff > where you can give a commit id, and it should only work on the files > mentioned in that commit, but it doesn't seem to focus on only the new > code in that commit. Is it possible to add support for that? And a related question: is it possible to skip certain tests? Basically, I don't want to see reports of code improvements, unless it is for a new source file. Reports of dangerous/wrong constructs are always welcome, but code improvements like these string_choice helpers really only make sense for patches adding new source files. Regards, Hans > > julia > >> >> I agree with you, a "improvement cocci" shall not force us to drop the >> pen and work full time to fix it :) >> When a new "improvement" cocci check is landed, we should update our >> "allowlist" immediately to ignore those warnings until we slowly >> improve our codebase to meet the standard. >> That way the CI is not affected. >> >> Regarding this patchset.... It is pretty big, but also pretty simple. >> I added my "extra changes" on the cover letter to ease the review. >> >> If you or someone else have time to review it... then it will be great >> if we land it. But if none has time for it, then it can be ignored. >> >> >> Regards! >> >>> >>> Hans >>> >>>> >>>>> diff --git a/drivers/media/dvb-frontends/ascot2e.c b/drivers/media/dvb-frontends/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 == 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-frontends/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 == 0), addr, reg, len, len, data); >>>>> + str_write_read(write), addr, reg, len, len, data); >>>>> } >>>>> >>>>> static int cxd2841er_write_regs(struct cxd2841er_priv *priv, >>>>> diff --git a/drivers/media/dvb-frontends/helene.c b/drivers/media/dvb-frontends/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 == 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-frontends/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 == 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 = 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); >>>>> 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 = 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 == rc)); >>>>> + str_yes_no(rc == 1)); >>>>> if (rc == 1) >>>>> dev->has_remote = 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 = 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 == rc)); >>>>> + str_yes_no(rc == 1)); >>>>> break; >>>>> case SAA7134_BOARD_SNAZIO_TVPVR_PRO: >>>>> dev->init_data.name = "SnaZio* TVPVR PRO"; >>>>> @@ -931,7 +931,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) >>>>> rc = 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 == rc)); >>>>> + str_yes_no(rc == 1)); >>>>> break; >>>>> case SAA7134_BOARD_HAUPPAUGE_HVR1110: >>>>> dev->init_data.name = saa7134_boards[dev->board].name; >>>>> diff --git a/drivers/media/usb/pvrusb2/pvrusb2-ctrl.c b/drivers/media/usb/pvrusb2/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 *cptr, >>>>> *len = scnprintf(buf,maxlen,"%d",val); >>>>> ret = 0; >>>>> } else if (cptr->info->type == pvr2_ctl_bool) { >>>>> - *len = scnprintf(buf,maxlen,"%s",str_true_false(val)); >>>>> + *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-hdw.c b/drivers/media/usb/pvrusb2/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 <ribalda@chromium.org> >>>>> --- >>>>> 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 >>>> >>> >> >> >> -- >> Ricardo Ribalda >> >
> >> Julia, correct me if I am wrong, but I believe that cocci does not > >> have the ability to check only new code. It runs against files not > >> diffs. > > > > Coccinelle runs on files normally. There is an option --use-patch-diff > > where you can give a commit id, and it should only work on the files > > mentioned in that commit, but it doesn't seem to focus on only the new > > code in that commit. > > Is it possible to add support for that? It should be possible. The tricky part is that Coccinelle can match eg foo(); ... -bar() +xxx() So should the code be patched only if bar() is new? Or also if foo() is new. > And a related question: is it possible to skip certain tests? You can specify the test you want to have run, but I don't think there is a way to do the opposite: make coccicheck COCCI=<my_SP.cocci> MODE=patch Maybe if there is a way to focus on specific lines, the problem would go away? julia > > Basically, I don't want to see reports of code improvements, unless it is > for a new source file. Reports of dangerous/wrong constructs are always > welcome, but code improvements like these string_choice helpers really only > make sense for patches adding new source files. > > Regards, > > Hans > > > > > julia > > > >> > >> I agree with you, a "improvement cocci" shall not force us to drop the > >> pen and work full time to fix it :) > >> When a new "improvement" cocci check is landed, we should update our > >> "allowlist" immediately to ignore those warnings until we slowly > >> improve our codebase to meet the standard. > >> That way the CI is not affected. > >> > >> Regarding this patchset.... It is pretty big, but also pretty simple. > >> I added my "extra changes" on the cover letter to ease the review. > >> > >> If you or someone else have time to review it... then it will be great > >> if we land it. But if none has time for it, then it can be ignored. > >> > >> > >> Regards! > >> > >>> > >>> Hans > >>> > >>>> > >>>>> diff --git a/drivers/media/dvb-frontends/ascot2e.c b/drivers/media/dvb-frontends/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 == 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-frontends/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 == 0), addr, reg, len, len, data); > >>>>> + str_write_read(write), addr, reg, len, len, data); > >>>>> } > >>>>> > >>>>> static int cxd2841er_write_regs(struct cxd2841er_priv *priv, > >>>>> diff --git a/drivers/media/dvb-frontends/helene.c b/drivers/media/dvb-frontends/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 == 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-frontends/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 == 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 = 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); > >>>>> 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 = 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 == rc)); > >>>>> + str_yes_no(rc == 1)); > >>>>> if (rc == 1) > >>>>> dev->has_remote = 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 = 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 == rc)); > >>>>> + str_yes_no(rc == 1)); > >>>>> break; > >>>>> case SAA7134_BOARD_SNAZIO_TVPVR_PRO: > >>>>> dev->init_data.name = "SnaZio* TVPVR PRO"; > >>>>> @@ -931,7 +931,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) > >>>>> rc = 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 == rc)); > >>>>> + str_yes_no(rc == 1)); > >>>>> break; > >>>>> case SAA7134_BOARD_HAUPPAUGE_HVR1110: > >>>>> dev->init_data.name = saa7134_boards[dev->board].name; > >>>>> diff --git a/drivers/media/usb/pvrusb2/pvrusb2-ctrl.c b/drivers/media/usb/pvrusb2/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 *cptr, > >>>>> *len = scnprintf(buf,maxlen,"%d",val); > >>>>> ret = 0; > >>>>> } else if (cptr->info->type == pvr2_ctl_bool) { > >>>>> - *len = scnprintf(buf,maxlen,"%s",str_true_false(val)); > >>>>> + *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-hdw.c b/drivers/media/usb/pvrusb2/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 <ribalda@chromium.org> > >>>>> --- > >>>>> 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 > >>>> > >>> > >> > >> > >> -- > >> Ricardo Ribalda > >> > > > >
On Mon, Sep 30, 2024 at 02:53:51PM +0200, Ricardo Ribalda wrote: > On Mon, 30 Sept 2024 at 14:38, Hans Verkuil wrote: > > On 30/09/2024 14:21, Laurent Pinchart wrote: > > > Hi Ricardo, > > > > > > On Mon, Sep 30, 2024 at 12:03:55PM +0000, Ricardo Ribalda wrote: > > >> 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: > > > > > > Personally I think most of those helpers just hinder readability for not > > > much added gain. String de-duplication is done by the linker already. > > > The only value I see in the helpers is ensuring that the strings are > > > consistently written, and I think we can do so through other means. > > > > Just my opinion: I'm OK with these new helpers, but I am not too keen to apply > > all this to existing source code. I.e., for new code it is fine, but if we have > > to update all drivers every time a new cocci test is added, then that will not > > scale. > > > > Note that I never ran cocci in my build scripts, so this is a new check that > > we haven't set rules for or have much experience with. > > > > checkpatch just checks the patches, it doesn't force you to fix existing code. > > > > Some of the cocci tests are clearly checking for incorrect code, but others are > > for code improvements (i.e. the code was correct, it can just be done slightly > > better). It's the second category were I think that should only apply to new code, > > and not existing code. > > > > Regards, > > Julia, correct me if I am wrong, but I believe that cocci does not > have the ability to check only new code. It runs against files not > diffs. > > I agree with you, a "improvement cocci" shall not force us to drop the > pen and work full time to fix it :) > When a new "improvement" cocci check is landed, we should update our > "allowlist" immediately to ignore those warnings until we slowly > improve our codebase to meet the standard. > That way the CI is not affected. > > Regarding this patchset.... It is pretty big, but also pretty simple. > I added my "extra changes" on the cover letter to ease the review. > > If you or someone else have time to review it... then it will be great > if we land it. But if none has time for it, then it can be ignored. More than just a matter of review time, I would prefer avoiding these changes in the drivers I maintain. > > >> diff --git a/drivers/media/dvb-frontends/ascot2e.c b/drivers/media/dvb-frontends/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 == 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-frontends/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 == 0), addr, reg, len, len, data); > > >> + str_write_read(write), addr, reg, len, len, data); > > >> } > > >> > > >> static int cxd2841er_write_regs(struct cxd2841er_priv *priv, > > >> diff --git a/drivers/media/dvb-frontends/helene.c b/drivers/media/dvb-frontends/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 == 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-frontends/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 == 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 = 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); > > >> 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 = 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 == rc)); > > >> + str_yes_no(rc == 1)); > > >> if (rc == 1) > > >> dev->has_remote = 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 = 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 == rc)); > > >> + str_yes_no(rc == 1)); > > >> break; > > >> case SAA7134_BOARD_SNAZIO_TVPVR_PRO: > > >> dev->init_data.name = "SnaZio* TVPVR PRO"; > > >> @@ -931,7 +931,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) > > >> rc = 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 == rc)); > > >> + str_yes_no(rc == 1)); > > >> break; > > >> case SAA7134_BOARD_HAUPPAUGE_HVR1110: > > >> dev->init_data.name = saa7134_boards[dev->board].name; > > >> diff --git a/drivers/media/usb/pvrusb2/pvrusb2-ctrl.c b/drivers/media/usb/pvrusb2/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 *cptr, > > >> *len = scnprintf(buf,maxlen,"%d",val); > > >> ret = 0; > > >> } else if (cptr->info->type == pvr2_ctl_bool) { > > >> - *len = scnprintf(buf,maxlen,"%s",str_true_false(val)); > > >> + *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-hdw.c b/drivers/media/usb/pvrusb2/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 <ribalda@chromium.org> > > >> --- > > >> 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 -- Regards, Laurent Pinchart
On September 30, 2024 8:38:22 AM EDT, Hans Verkuil <hverkuil@xs4all.nl> wrote: >On 30/09/2024 14:21, Laurent Pinchart wrote: >> Hi Ricardo, >> >> On Mon, Sep 30, 2024 at 12:03:55PM +0000, Ricardo Ribalda wrote: >>> 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: >> >> Personally I think most of those helpers just hinder readability for not >> much added gain. String de-duplication is done by the linker already. >> The only value I see in the helpers is ensuring that the strings are >> consistently written, and I think we can do so through other means. > >Just my opinion: I'm OK with these new helpers, but I am not too keen to apply >all this to existing source code. I.e., for new code it is fine, but if we have >to update all drivers every time a new cocci test is added, then that will not >scale. > >Note that I never ran cocci in my build scripts, so this is a new check that >we haven't set rules for or have much experience with. > >checkpatch just checks the patches, it doesn't force you to fix existing code. > >Some of the cocci tests are clearly checking for incorrect code, but others are >for code improvements (i.e. the code was correct, it can just be done slightly >better). It's the second category were I think that should only apply to new code, >and not existing code. > >Regards, > > Hans > >> >>> diff --git a/drivers/media/dvb-frontends/ascot2e.c b/drivers/media/dvb-frontends/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 == 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-frontends/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 == 0), addr, reg, len, len, data); >>> + str_write_read(write), addr, reg, len, len, data); >>> } >>> >>> static int cxd2841er_write_regs(struct cxd2841er_priv *priv, >>> diff --git a/drivers/media/dvb-frontends/helene.c b/drivers/media/dvb-frontends/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 == 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-frontends/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 == 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 = 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); >>> 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 = 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 == rc)); >>> + str_yes_no(rc == 1)); >>> if (rc == 1) >>> dev->has_remote = 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 = 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 == rc)); >>> + str_yes_no(rc == 1)); >>> break; >>> case SAA7134_BOARD_SNAZIO_TVPVR_PRO: >>> dev->init_data.name = "SnaZio* TVPVR PRO"; >>> @@ -931,7 +931,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) >>> rc = 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 == rc)); >>> + str_yes_no(rc == 1)); >>> break; >>> case SAA7134_BOARD_HAUPPAUGE_HVR1110: >>> dev->init_data.name = saa7134_boards[dev->board].name; >>> diff --git a/drivers/media/usb/pvrusb2/pvrusb2-ctrl.c b/drivers/media/usb/pvrusb2/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 *cptr, >>> *len = scnprintf(buf,maxlen,"%d",val); >>> ret = 0; >>> } else if (cptr->info->type == pvr2_ctl_bool) { >>> - *len = scnprintf(buf,maxlen,"%s",str_true_false(val)); >>> + *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-hdw.c b/drivers/media/usb/pvrusb2/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 <ribalda@chromium.org> >>> --- >>> 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 >> > Hi Ricardo, I'll go a little further than Hans and Laurent: I staunchly oppose what I call editorial changes: 'sed s/happy/glad/g' in code that has been working for a long time for which many do not have time or hardware to perform regression tests against. Please explain the return on investment for why this change should be applied? Help me to understand how that return outweighs the risk of introducing a bug? (No human being really code reviews sweeping editorial change like these thoroughly.) -Andy
On Mon, Sep 30, 2024 at 08:57:44AM -0400, Andy Walls wrote: > No human being really code reviews sweeping editorial change like these thoroughly. I wonder if there is some way to verify that people are actually running the Coccinelle script that they say they are without doing anything extra on the side. I use a script to filter out mechanical changes. https://github.com/error27/rename_rev It's kind of a pain in the butt to review something like this. The command would be something like: rename_rev.pl -e 's/(.*?,|^\W+)(.*) \? "enabled" : "disabled"/$1str_enabled_disabled($2)/' -e 's/(.*?,|^\W+)(.*) \? "enable" : "disable"/$1str_enable_disable($2)/' -e 's/(.*,|^\W+)(.*) \? "low" : "high"/$1str_low_high($2)/' -e 's/(.*,|^\W+)(.*) \? "on" : "off"/$1str_on_off($2)/' -e 's/(.*,|^\W+)(.*) \? "true" : "false"/$1str_true_false($2)/' -e 's/(.*,|^\W+)(.*) \? "high" : "low"/$1str_high_low($2)/' -e 's/(.*,|^\W+)(.*) \? "read" : "write"/$1str_read_write($2)/' For every email in the series there was another new str_foo_bar() function so the command line kept getting longer and longer. It doesn't work perfectly, but it's often good enough so I can spot the interesting bits. regards, dan carpenter
On Mon, Sep 30, 2024 at 02:38:22PM +0200, Hans Verkuil wrote: > On 30/09/2024 14:21, Laurent Pinchart wrote: > > Hi Ricardo, > > > > On Mon, Sep 30, 2024 at 12:03:55PM +0000, Ricardo Ribalda wrote: > >> 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: > > > > Personally I think most of those helpers just hinder readability for not > > much added gain. String de-duplication is done by the linker already. > > The only value I see in the helpers is ensuring that the strings are > > consistently written, and I think we can do so through other means. > > Just my opinion: I'm OK with these new helpers, Coding style opinions are personal preferences of course :-) My opinion is that this hinders readability for no benefit. > but I am not too keen to apply > all this to existing source code. I.e., for new code it is fine, but if we have > to update all drivers every time a new cocci test is added, then that will not > scale. > > Note that I never ran cocci in my build scripts, so this is a new check that > we haven't set rules for or have much experience with. > > checkpatch just checks the patches, it doesn't force you to fix existing code. > > Some of the cocci tests are clearly checking for incorrect code, but others are > for code improvements (i.e. the code was correct, it can just be done slightly > better). It's the second category were I think that should only apply to new code, > and not existing code. > > >> diff --git a/drivers/media/dvb-frontends/ascot2e.c b/drivers/media/dvb-frontends/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 == 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-frontends/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 == 0), addr, reg, len, len, data); > >> + str_write_read(write), addr, reg, len, len, data); > >> } > >> > >> static int cxd2841er_write_regs(struct cxd2841er_priv *priv, > >> diff --git a/drivers/media/dvb-frontends/helene.c b/drivers/media/dvb-frontends/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 == 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-frontends/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 == 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 = 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); > >> 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 = 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 == rc)); > >> + str_yes_no(rc == 1)); > >> if (rc == 1) > >> dev->has_remote = 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 = 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 == rc)); > >> + str_yes_no(rc == 1)); > >> break; > >> case SAA7134_BOARD_SNAZIO_TVPVR_PRO: > >> dev->init_data.name = "SnaZio* TVPVR PRO"; > >> @@ -931,7 +931,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) > >> rc = 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 == rc)); > >> + str_yes_no(rc == 1)); > >> break; > >> case SAA7134_BOARD_HAUPPAUGE_HVR1110: > >> dev->init_data.name = saa7134_boards[dev->board].name; > >> diff --git a/drivers/media/usb/pvrusb2/pvrusb2-ctrl.c b/drivers/media/usb/pvrusb2/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 *cptr, > >> *len = scnprintf(buf,maxlen,"%d",val); > >> ret = 0; > >> } else if (cptr->info->type == pvr2_ctl_bool) { > >> - *len = scnprintf(buf,maxlen,"%s",str_true_false(val)); > >> + *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-hdw.c b/drivers/media/usb/pvrusb2/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 <ribalda@chromium.org> > >> --- > >> 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 -- Regards, Laurent Pinchart
Em Mon, 30 Sep 2024 15:46:19 +0300 Laurent Pinchart <laurent.pinchart@ideasonboard.com> escreveu: > > >> Cocci has located some places where the helpers can be used. This > > >> patchset uses the diff generated by cocci, plus these changes: > > > > > > Personally I think most of those helpers just hinder readability for not > > > much added gain. String de-duplication is done by the linker already. > > > The only value I see in the helpers is ensuring that the strings are > > > consistently written, and I think we can do so through other means. > > > > Just my opinion: I'm OK with these new helpers, > > Coding style opinions are personal preferences of course :-) My opinion > is that this hinders readability for no benefit. Agreed. New code somewhat obfuscates what it does with no benefit except maybe saving a few bytes on each drive. Thanks, Mauro
The following cocci warnings are fixed:
drivers/staging/media/ipu3/ipu3-v4l2.c:290:3-31: opportunity for str_enabled_disabled(flags & MEDIA_LNK_FL_ENABLED)
drivers/staging/media/ipu3/ipu3-v4l2.c:305:3-31: opportunity for str_enabled_disabled(flags & MEDIA_LNK_FL_ENABLED)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/staging/media/ipu3/ipu3-v4l2.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c
index e7aee7e3db5b..443067ad0a50 100644
--- a/drivers/staging/media/ipu3/ipu3-v4l2.c
+++ b/drivers/staging/media/ipu3/ipu3-v4l2.c
@@ -287,7 +287,7 @@ static int imgu_link_setup(struct media_entity *entity,
WARN_ON(pad >= IMGU_NODE_NUM);
dev_dbg(&imgu->pci_dev->dev, "pipe %u pad %u is %s", pipe, pad,
- flags & MEDIA_LNK_FL_ENABLED ? "enabled" : "disabled");
+ str_enabled_disabled(flags & MEDIA_LNK_FL_ENABLED));
imgu_pipe = &imgu->imgu_pipe[pipe];
imgu_pipe->nodes[pad].enabled = flags & MEDIA_LNK_FL_ENABLED;
@@ -302,7 +302,7 @@ static int imgu_link_setup(struct media_entity *entity,
__clear_bit(pipe, imgu->css.enabled_pipes);
dev_dbg(&imgu->pci_dev->dev, "pipe %u is %s", pipe,
- flags & MEDIA_LNK_FL_ENABLED ? "enabled" : "disabled");
+ str_enabled_disabled(flags & MEDIA_LNK_FL_ENABLED));
return 0;
}
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/staging/media/atomisp/pci/sh_css.c:1490:16-19: opportunity for str_true_false(map)
drivers/staging/media/atomisp/pci/atomisp_compat_css20.c:855:2-8: opportunity for str_enable_disable(enable)
drivers/staging/media/atomisp/pci/atomisp_v4l2.c:542:40-46: opportunity for str_on_off(enable)
drivers/staging/media/atomisp/pci/atomisp_v4l2.c:584:48-54: opportunity for str_on_off(enable)
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c:1006:2-4: opportunity for str_on_off(on)
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c:1019:3-5: opportunity for str_on_off(on)
drivers/staging/media/atomisp/pci/atomisp_csi2_bridge.c:394:9-19: opportunity for str_low_high(active_low)
drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c:1253:3-35: opportunity for str_true_false(xcandidate -> sp . enable . continuous)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/staging/media/atomisp/pci/atomisp_compat_css20.c | 2 +-
drivers/staging/media/atomisp/pci/atomisp_csi2_bridge.c | 2 +-
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 4 ++--
drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 4 ++--
drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c | 2 +-
drivers/staging/media/atomisp/pci/sh_css.c | 2 +-
6 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
index a62a5c0b3c00..34e68ea1b1f4 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
@@ -852,7 +852,7 @@ int atomisp_css_irq_enable(struct atomisp_device *isp,
{
dev_dbg(isp->dev, "%s: css irq info 0x%08x: %s (%d).\n",
__func__, info,
- enable ? "enable" : "disable", enable);
+ str_enable_disable(enable), enable);
if (ia_css_irq_enable(info, enable)) {
dev_warn(isp->dev, "%s:Invalid irq info: 0x%08x when %s.\n",
__func__, info,
diff --git a/drivers/staging/media/atomisp/pci/atomisp_csi2_bridge.c b/drivers/staging/media/atomisp/pci/atomisp_csi2_bridge.c
index 6abda358a72f..7d1905791b9a 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_csi2_bridge.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_csi2_bridge.c
@@ -391,7 +391,7 @@ static int atomisp_csi2_handle_acpi_gpio_res(struct acpi_resource *ares, void *_
acpi_handle_info(data->adev->handle, "%s: %s crs %d %s pin %u active-%s\n",
dev_name(&data->adev->dev), name,
data->res_count - 1, agpio->resource_source.string_ptr,
- pin, active_low ? "low" : "high");
+ pin, str_low_high(active_low));
return 1;
}
diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
index e176483df301..85e7d14ef394 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
@@ -1003,7 +1003,7 @@ static int gmin_acpi_pm_ctrl(struct v4l2_subdev *subdev, int on)
return 0;
dev_dbg(subdev->dev, "Setting power state to %s\n",
- on ? "on" : "off");
+ str_on_off(on));
if (on)
ret = acpi_device_set_power(adev,
@@ -1016,7 +1016,7 @@ static int gmin_acpi_pm_ctrl(struct v4l2_subdev *subdev, int on)
gs->clock_on = on;
else
dev_err(subdev->dev, "Couldn't set power state to %s\n",
- on ? "on" : "off");
+ str_on_off(on));
return ret;
}
diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
index c9984f1557b0..6fd18217df1e 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
@@ -539,7 +539,7 @@ static int atomisp_mrfld_power(struct atomisp_device *isp, bool enable)
u32 val = enable ? MRFLD_ISPSSPM0_IUNIT_POWER_ON :
MRFLD_ISPSSPM0_IUNIT_POWER_OFF;
- dev_dbg(isp->dev, "IUNIT power-%s.\n", enable ? "on" : "off");
+ dev_dbg(isp->dev, "IUNIT power-%s.\n", str_on_off(enable));
/* WA for P-Unit, if DVFS enabled, ISP timeout observed */
if (IS_CHT && enable && !isp->pm_only) {
@@ -581,7 +581,7 @@ static int atomisp_mrfld_power(struct atomisp_device *isp, bool enable)
usleep_range(100, 150);
} while (1);
- dev_err(isp->dev, "IUNIT power-%s timeout.\n", enable ? "on" : "off");
+ dev_err(isp->dev, "IUNIT power-%s timeout.\n", str_on_off(enable));
return -EBUSY;
}
diff --git a/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c b/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c
index 7ce2b2d6da11..7e295bc83464 100644
--- a/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c
+++ b/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c
@@ -1250,7 +1250,7 @@ int ia_css_binary_find(struct ia_css_binary_descr *descr, struct ia_css_binary *
dev_dbg(atomisp_dev, "Using binary %s (id %d), type %d, mode %d, continuous %s\n",
xcandidate->blob->name, xcandidate->sp.id, xcandidate->type,
xcandidate->sp.pipeline.mode,
- xcandidate->sp.enable.continuous ? "true" : "false");
+ str_true_false(xcandidate->sp.enable.continuous));
if (err)
dev_err(atomisp_dev, "Failed to find a firmware binary matching the pipeline parameters\n");
diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c
index ca97ea082cf4..89a694453e6f 100644
--- a/drivers/staging/media/atomisp/pci/sh_css.c
+++ b/drivers/staging/media/atomisp/pci/sh_css.c
@@ -1487,7 +1487,7 @@ map_sp_threads(struct ia_css_stream *stream, bool map)
enum ia_css_pipe_id pipe_id;
IA_CSS_ENTER_PRIVATE("stream = %p, map = %s",
- stream, map ? "true" : "false");
+ stream, str_true_false(map));
if (!stream) {
IA_CSS_LEAVE_ERR_PRIVATE(-EINVAL);
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/media/v4l2-core/v4l2-fwnode.c:282:32-33: opportunity for str_high_low(v)
drivers/media/v4l2-core/v4l2-fwnode.c:290:32-33: opportunity for str_high_low(v)
drivers/media/v4l2-core/v4l2-fwnode.c:298:37-38: opportunity for str_high_low(v)
drivers/media/v4l2-core/v4l2-fwnode.c:329:31-32: opportunity for str_high_low(v)
drivers/media/v4l2-core/v4l2-fwnode.c:356:40-41: opportunity for str_high_low(v)
drivers/media/v4l2-core/v4l2-fwnode.c:364:38-39: opportunity for str_high_low(v)
drivers/media/v4l2-core/v4l2-ctrls-core.c:272:16-26: opportunity for str_true_false(* ptr . p_s32)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/v4l2-core/v4l2-ctrls-core.c | 3 ++-
drivers/media/v4l2-core/v4l2-fwnode.c | 12 ++++++------
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/media/v4l2-core/v4l2-ctrls-core.c b/drivers/media/v4l2-core/v4l2-ctrls-core.c
index eeab6a5eb7ba..f303c70dffae 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls-core.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls-core.c
@@ -8,6 +8,7 @@
#include <linux/export.h>
#include <linux/mm.h>
#include <linux/slab.h>
+#include <linux/string_choices.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-event.h>
#include <media/v4l2-fwnode.h>
@@ -269,7 +270,7 @@ void v4l2_ctrl_type_op_log(const struct v4l2_ctrl *ctrl)
pr_cont("%d", *ptr.p_s32);
break;
case V4L2_CTRL_TYPE_BOOLEAN:
- pr_cont("%s", *ptr.p_s32 ? "true" : "false");
+ pr_cont("%s", str_true_false(*ptr.p_s32));
break;
case V4L2_CTRL_TYPE_MENU:
pr_cont("%s", ctrl->qmenu[*ptr.p_s32]);
diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c
index f19c8adf2c61..92dc17179018 100644
--- a/drivers/media/v4l2-core/v4l2-fwnode.c
+++ b/drivers/media/v4l2-core/v4l2-fwnode.c
@@ -279,7 +279,7 @@ v4l2_fwnode_endpoint_parse_parallel_bus(struct fwnode_handle *fwnode,
V4L2_MBUS_HSYNC_ACTIVE_LOW);
flags |= v ? V4L2_MBUS_HSYNC_ACTIVE_HIGH :
V4L2_MBUS_HSYNC_ACTIVE_LOW;
- pr_debug("hsync-active %s\n", v ? "high" : "low");
+ pr_debug("hsync-active %s\n", str_high_low(v));
}
if (!fwnode_property_read_u32(fwnode, "vsync-active", &v)) {
@@ -287,7 +287,7 @@ v4l2_fwnode_endpoint_parse_parallel_bus(struct fwnode_handle *fwnode,
V4L2_MBUS_VSYNC_ACTIVE_LOW);
flags |= v ? V4L2_MBUS_VSYNC_ACTIVE_HIGH :
V4L2_MBUS_VSYNC_ACTIVE_LOW;
- pr_debug("vsync-active %s\n", v ? "high" : "low");
+ pr_debug("vsync-active %s\n", str_high_low(v));
}
if (!fwnode_property_read_u32(fwnode, "field-even-active", &v)) {
@@ -295,7 +295,7 @@ v4l2_fwnode_endpoint_parse_parallel_bus(struct fwnode_handle *fwnode,
V4L2_MBUS_FIELD_EVEN_LOW);
flags |= v ? V4L2_MBUS_FIELD_EVEN_HIGH :
V4L2_MBUS_FIELD_EVEN_LOW;
- pr_debug("field-even-active %s\n", v ? "high" : "low");
+ pr_debug("field-even-active %s\n", str_high_low(v));
}
if (!fwnode_property_read_u32(fwnode, "pclk-sample", &v)) {
@@ -326,7 +326,7 @@ v4l2_fwnode_endpoint_parse_parallel_bus(struct fwnode_handle *fwnode,
V4L2_MBUS_DATA_ACTIVE_LOW);
flags |= v ? V4L2_MBUS_DATA_ACTIVE_HIGH :
V4L2_MBUS_DATA_ACTIVE_LOW;
- pr_debug("data-active %s\n", v ? "high" : "low");
+ pr_debug("data-active %s\n", str_high_low(v));
}
if (fwnode_property_present(fwnode, "slave-mode")) {
@@ -353,7 +353,7 @@ v4l2_fwnode_endpoint_parse_parallel_bus(struct fwnode_handle *fwnode,
V4L2_MBUS_VIDEO_SOG_ACTIVE_LOW);
flags |= v ? V4L2_MBUS_VIDEO_SOG_ACTIVE_HIGH :
V4L2_MBUS_VIDEO_SOG_ACTIVE_LOW;
- pr_debug("sync-on-green-active %s\n", v ? "high" : "low");
+ pr_debug("sync-on-green-active %s\n", str_high_low(v));
}
if (!fwnode_property_read_u32(fwnode, "data-enable-active", &v)) {
@@ -361,7 +361,7 @@ v4l2_fwnode_endpoint_parse_parallel_bus(struct fwnode_handle *fwnode,
V4L2_MBUS_DATA_ENABLE_LOW);
flags |= v ? V4L2_MBUS_DATA_ENABLE_HIGH :
V4L2_MBUS_DATA_ENABLE_LOW;
- pr_debug("data-enable-active %s\n", v ? "high" : "low");
+ pr_debug("data-enable-active %s\n", str_high_low(v));
}
switch (bus_type) {
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warning is fixed:
drivers/media/usb/pwc/pwc-ctrl.c:492:5-10: opportunity for str_on_off(power)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/usb/pwc/pwc-ctrl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/usb/pwc/pwc-ctrl.c b/drivers/media/usb/pwc/pwc-ctrl.c
index cff64d872058..a1b4eeb41cfe 100644
--- a/drivers/media/usb/pwc/pwc-ctrl.c
+++ b/drivers/media/usb/pwc/pwc-ctrl.c
@@ -489,7 +489,7 @@ void pwc_camera_power(struct pwc_device *pdev, int power)
SET_POWER_SAVE_MODE_FORMATTER, pdev->ctrl_buf, 1);
if (r < 0)
PWC_ERROR("Failed to power %s camera (%d)\n",
- power ? "on" : "off", r);
+ str_on_off(power), r);
}
int pwc_set_leds(struct pwc_device *pdev, int on_value, int off_value)
--
2.46.1.824.gd892dcdcdd-goog
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 <ribalda@chromium.org>
---
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 <linux/string.h>
+#include <linux/string_choices.h>
#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(" [");
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/media/usb/em28xx/em28xx-i2c.c:579:3-29: opportunity for str_read_write(( msgs [ i ] . flags & I2C_M_RD ))
drivers/media/usb/em28xx/em28xx-i2c.c:590:2-28: opportunity for str_read_write(( msgs [ i ] . flags & I2C_M_RD ))
drivers/media/usb/em28xx/em28xx-video.c:941:4-9: opportunity for str_enabled_disabled(flags)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/usb/em28xx/em28xx-i2c.c | 4 ++--
drivers/media/usb/em28xx/em28xx-video.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c
index a7eb11f7fb34..62fe49876a32 100644
--- a/drivers/media/usb/em28xx/em28xx-i2c.c
+++ b/drivers/media/usb/em28xx/em28xx-i2c.c
@@ -576,7 +576,7 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
goto error;
dprintk(2, "%s %s addr=%02x len=%d: %*ph\n",
- (msgs[i].flags & I2C_M_RD) ? "read" : "write",
+ str_read_write(msgs[i].flags & I2C_M_RD),
i == num - 1 ? "stop" : "nonstop",
addr, msgs[i].len,
msgs[i].len, msgs[i].buf);
@@ -587,7 +587,7 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
error:
dprintk(2, "%s %s addr=%02x len=%d: %sERROR: %i\n",
- (msgs[i].flags & I2C_M_RD) ? "read" : "write",
+ str_read_write(msgs[i].flags & I2C_M_RD),
i == num - 1 ? "stop" : "nonstop",
addr, msgs[i].len,
(rc == -ENODEV) ? "no device " : "",
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
index 4aef584e21da..ff017c187aff 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -938,7 +938,7 @@ static int em28xx_enable_analog_tuner(struct em28xx *dev)
dev_err(&dev->intf->dev,
"Couldn't change link %s->%s to %s. Error %d\n",
source->name, sink->name,
- flags ? "enabled" : "disabled",
+ str_enabled_disabled(flags),
ret);
return ret;
}
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/media/usb/dvb-usb/opera1.c:326:26-31: opportunity for str_enable_disable(onoff)
drivers/media/usb/dvb-usb/opera1.c:310:3-8: opportunity for str_on_off(onoff)
drivers/media/usb/dvb-usb/opera1.c:283:19-24: opportunity for str_on_off(onoff)
drivers/media/usb/dvb-usb/opera1.c:296:23-28: opportunity for str_on_off(onoff)
drivers/media/usb/dvb-usb/dvb-usb-dvb.c:49:21-26: opportunity for str_on_off(onoff)
drivers/media/usb/dvb-usb/dvb-usb-dvb.c:47:2-46: opportunity for str_yes_no(adap -> fe_adap [ adap -> active_fe ] . pid_filtering)
drivers/media/usb/dvb-usb/af9005-fe.c:1282:27-31: opportunity for str_high_low(temp)
drivers/media/usb/dvb-usb/af9005-fe.c:790:30-32: opportunity for str_on_off(on)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
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 ++++----
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/media/usb/dvb-usb/af9005-fe.c b/drivers/media/usb/dvb-usb/af9005-fe.c
index 404e56b32145..ea3aaf3a56cb 100644
--- a/drivers/media/usb/dvb-usb/af9005-fe.c
+++ b/drivers/media/usb/dvb-usb/af9005-fe.c
@@ -787,7 +787,7 @@ static int af9005_fe_power(struct dvb_frontend *fe, int on)
struct af9005_fe_state *state = fe->demodulator_priv;
u8 temp = on;
int ret;
- deb_info("power %s tuner\n", on ? "on" : "off");
+ deb_info("power %s tuner\n", str_on_off(on));
ret = af9005_send_command(state->d, 0x03, &temp, 1, NULL, 0);
return ret;
}
@@ -1279,7 +1279,7 @@ static int af9005_fe_get_frontend(struct dvb_frontend *fe,
if (ret)
return ret;
/* if temp is set = high priority */
- deb_info("PRIORITY %s\n", temp ? "high" : "low");
+ deb_info("PRIORITY %s\n", str_high_low(temp));
/* high coderate */
ret =
diff --git a/drivers/media/usb/dvb-usb/dvb-usb-dvb.c b/drivers/media/usb/dvb-usb/dvb-usb-dvb.c
index 0a7f8ba90992..b663c3dff25c 100644
--- a/drivers/media/usb/dvb-usb/dvb-usb-dvb.c
+++ b/drivers/media/usb/dvb-usb/dvb-usb-dvb.c
@@ -44,9 +44,9 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
/* activate the pid on the device specific pid_filter */
deb_ts("setting pid (%s): %5d %04x at index %d '%s'\n",
- adap->fe_adap[adap->active_fe].pid_filtering ?
- "yes" : "no", dvbdmxfeed->pid, dvbdmxfeed->pid,
- dvbdmxfeed->index, onoff ? "on" : "off");
+ str_yes_no(adap->fe_adap[adap->active_fe].pid_filtering),
+ dvbdmxfeed->pid, dvbdmxfeed->pid,
+ dvbdmxfeed->index, str_on_off(onoff));
if (adap->props.fe[adap->active_fe].caps & DVB_USB_ADAP_HAS_PID_FILTER &&
adap->fe_adap[adap->active_fe].pid_filtering &&
adap->props.fe[adap->active_fe].pid_filter != NULL)
diff --git a/drivers/media/usb/dvb-usb/opera1.c b/drivers/media/usb/dvb-usb/opera1.c
index 268f05fc8691..8412b64660d8 100644
--- a/drivers/media/usb/dvb-usb/opera1.c
+++ b/drivers/media/usb/dvb-usb/opera1.c
@@ -280,7 +280,7 @@ static int opera1_power_ctrl(struct dvb_usb_device *d, int onoff)
u8 val = onoff ? 0x01 : 0x00;
if (dvb_usb_opera1_debug)
- info("power %s", onoff ? "on" : "off");
+ info("power %s", str_on_off(onoff));
return opera1_xilinx_rw(d->udev, 0xb7, val,
&val, 1, OPERA_WRITE_MSG);
}
@@ -293,7 +293,7 @@ static int opera1_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
{.addr = ADDR_B1A6_STREAM_CTRL,.buf = onoff ? buf_start : buf_stop,.len = 2},
};
if (dvb_usb_opera1_debug)
- info("streaming %s", onoff ? "on" : "off");
+ info("streaming %s", str_on_off(onoff));
i2c_transfer(&adap->dev->i2c_adap, start_tuner, 1);
return 0;
}
@@ -307,7 +307,7 @@ static int opera1_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid,
};
if (dvb_usb_opera1_debug)
info("pidfilter index: %d pid: %d %s", index, pid,
- onoff ? "on" : "off");
+ str_on_off(onoff));
b_pid[0] = (2 * index) + 4;
b_pid[1] = onoff ? (pid & 0xff) : (0x00);
b_pid[2] = onoff ? ((pid >> 8) & 0xff) : (0x00);
@@ -323,7 +323,7 @@ static int opera1_pid_filter_control(struct dvb_usb_adapter *adap, int onoff)
{.addr = ADDR_B1A6_STREAM_CTRL,.buf = b_pid,.len = 3},
};
if (dvb_usb_opera1_debug)
- info("%s hw-pidfilter", onoff ? "enable" : "disable");
+ info("%s hw-pidfilter", str_enable_disable(onoff));
for (; u < 0x7e; u += 2) {
b_pid[0] = u;
b_pid[1] = 0;
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:250:3-22: opportunity for str_yes_no(adap -> pid_filtering)
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:337:3-22: opportunity for str_yes_no(adap -> pid_filtering)
drivers/media/usb/dvb-usb-v2/az6007.c:82:32-38: opportunity for str_enable_disable(enable)
drivers/media/usb/dvb-usb-v2/az6007.c:192:32-37: opportunity for str_enable_disable(onoff)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/usb/dvb-usb-v2/az6007.c | 4 ++--
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/media/usb/dvb-usb-v2/az6007.c b/drivers/media/usb/dvb-usb-v2/az6007.c
index 2410054ddb2c..1e9f946193a6 100644
--- a/drivers/media/usb/dvb-usb-v2/az6007.c
+++ b/drivers/media/usb/dvb-usb-v2/az6007.c
@@ -79,7 +79,7 @@ static int drxk_gate_ctrl(struct dvb_frontend *fe, int enable)
struct dvb_usb_adapter *adap = fe->sec_priv;
int status = 0;
- pr_debug("%s: %s\n", __func__, enable ? "enable" : "disable");
+ pr_debug("%s: %s\n", __func__, str_enable_disable(enable));
if (!adap || !st)
return -EINVAL;
@@ -189,7 +189,7 @@ static int az6007_streaming_ctrl(struct dvb_frontend *fe, int onoff)
{
struct dvb_usb_device *d = fe_to_d(fe);
- pr_debug("%s: %s\n", __func__, onoff ? "enable" : "disable");
+ pr_debug("%s: %s\n", __func__, str_enable_disable(onoff));
return az6007_write(d, 0xbc, onoff, 0, NULL, 0);
}
diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
index f1c79f351ec8..c0a40112d043 100644
--- a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
+++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
@@ -247,7 +247,7 @@ static int dvb_usb_start_feed(struct dvb_demux_feed *dvbdmxfeed)
dev_dbg(&d->udev->dev,
"%s: adap=%d active_fe=%d feed_type=%d setting pid [%s]: %04x (%04d) at index %d\n",
__func__, adap->id, adap->active_fe, dvbdmxfeed->type,
- adap->pid_filtering ? "yes" : "no", dvbdmxfeed->pid,
+ str_yes_no(adap->pid_filtering), dvbdmxfeed->pid,
dvbdmxfeed->pid, dvbdmxfeed->index);
/* wait init is done */
@@ -334,7 +334,7 @@ static int dvb_usb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
dev_dbg(&d->udev->dev,
"%s: adap=%d active_fe=%d feed_type=%d setting pid [%s]: %04x (%04d) at index %d\n",
__func__, adap->id, adap->active_fe, dvbdmxfeed->type,
- adap->pid_filtering ? "yes" : "no", dvbdmxfeed->pid,
+ str_yes_no(adap->pid_filtering), dvbdmxfeed->pid,
dvbdmxfeed->pid, dvbdmxfeed->index);
if (adap->active_fe == -1)
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/media/usb/cx231xx/cx231xx-video.c:144:4-9: opportunity for str_enabled_disabled(flags)
drivers/media/usb/cx231xx/cx231xx-i2c.c:373:4-30: opportunity for str_read_write(( msgs [ i ] . flags & I2C_M_RD ))
drivers/media/usb/cx231xx/cx231xx-i2c.c:402:4-32: opportunity for str_read_write(( msgs [ i + 1 ] . flags & I2C_M_RD ))
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/usb/cx231xx/cx231xx-i2c.c | 4 ++--
drivers/media/usb/cx231xx/cx231xx-video.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c b/drivers/media/usb/cx231xx/cx231xx-i2c.c
index 6da8e7943d94..6d8b70562f6d 100644
--- a/drivers/media/usb/cx231xx/cx231xx-i2c.c
+++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c
@@ -370,7 +370,7 @@ static int cx231xx_i2c_xfer(struct i2c_adapter *i2c_adap,
addr = msgs[i].addr;
dprintk2(2, "%s %s addr=0x%x len=%d:",
- (msgs[i].flags & I2C_M_RD) ? "read" : "write",
+ str_read_write(msgs[i].flags & I2C_M_RD),
i == num - 1 ? "stop" : "nonstop", addr, msgs[i].len);
if (!msgs[i].len) {
/* no len: check only for device presence */
@@ -399,7 +399,7 @@ static int cx231xx_i2c_xfer(struct i2c_adapter *i2c_adap,
}
/* read bytes */
dprintk2(2, "plus %s %s addr=0x%x len=%d:",
- (msgs[i+1].flags & I2C_M_RD) ? "read" : "write",
+ str_read_write(msgs[i + 1].flags & I2C_M_RD),
i+1 == num - 1 ? "stop" : "nonstop", addr, msgs[i+1].len);
rc = cx231xx_i2c_recv_bytes_with_saddr(i2c_adap,
&msgs[i],
diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c
index 435eb0b32cb1..4cdcfe635ad7 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -141,7 +141,7 @@ static int cx231xx_enable_analog_tuner(struct cx231xx *dev)
dev_err(dev->dev,
"Couldn't change link %s->%s to %s. Error %d\n",
source->name, sink->name,
- flags ? "enabled" : "disabled",
+ str_enabled_disabled(flags),
ret);
return ret;
} else
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/media/tuners/tda18250.c:110:3-12: opportunity for str_true_false(triggered)
drivers/media/tuners/tda9887.c:296:39-54: opportunity for str_high_low(( buf [ 0 ] & 0x20 ))
drivers/media/tuners/tda9887.c:298:39-54: opportunity for str_high_low(( buf [ 0 ] & 0x80 ))
drivers/media/tuners/tda9887.c:294:39-54: opportunity for str_yes_no(( buf [ 0 ] & 0x01 ))
drivers/media/tuners/tda9887.c:347:5-20: opportunity for str_yes_no(( buf [ 1 ] & 0x02 ))
drivers/media/tuners/tda9887.c:353:5-20: opportunity for str_yes_no(( buf [ 1 ] & 0x20 ))
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/tuners/tda18250.c | 2 +-
drivers/media/tuners/tda9887.c | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/media/tuners/tda18250.c b/drivers/media/tuners/tda18250.c
index 68d0275f29e1..853600c80839 100644
--- a/drivers/media/tuners/tda18250.c
+++ b/drivers/media/tuners/tda18250.c
@@ -107,7 +107,7 @@ static int tda18250_wait_for_irq(struct dvb_frontend *fe,
dev_dbg(&client->dev, "waited IRQ (0x%02x) %d ms, triggered: %s", irq,
jiffies_to_msecs(jiffies) -
(jiffies_to_msecs(timeout) - maxwait),
- triggered ? "true" : "false");
+ str_true_false(triggered));
if (!triggered)
return -ETIMEDOUT;
diff --git a/drivers/media/tuners/tda9887.c b/drivers/media/tuners/tda9887.c
index b2f7054c1832..f403dcf14aa0 100644
--- a/drivers/media/tuners/tda9887.c
+++ b/drivers/media/tuners/tda9887.c
@@ -291,11 +291,11 @@ static void dump_read_message(struct dvb_frontend *fe, unsigned char *buf)
"+ 12.5 kHz",
};
tuner_info("read: 0x%2x\n", buf[0]);
- tuner_info(" after power on : %s\n", (buf[0] & 0x01) ? "yes" : "no");
+ tuner_info(" after power on : %s\n", str_yes_no(buf[0] & 0x01));
tuner_info(" afc : %s\n", afc[(buf[0] >> 1) & 0x0f]);
- tuner_info(" fmif level : %s\n", (buf[0] & 0x20) ? "high" : "low");
+ tuner_info(" fmif level : %s\n", str_high_low(buf[0] & 0x20));
tuner_info(" afc window : %s\n", (buf[0] & 0x40) ? "in" : "out");
- tuner_info(" vfi level : %s\n", (buf[0] & 0x80) ? "high" : "low");
+ tuner_info(" vfi level : %s\n", str_high_low(buf[0] & 0x80));
}
static void dump_write_message(struct dvb_frontend *fe, unsigned char *buf)
@@ -344,13 +344,13 @@ static void dump_write_message(struct dvb_frontend *fe, unsigned char *buf)
tuner_info(" B0 video mode : %s\n",
(buf[1] & 0x01) ? "video trap" : "sound trap");
tuner_info(" B1 auto mute fm : %s\n",
- (buf[1] & 0x02) ? "yes" : "no");
+ str_yes_no(buf[1] & 0x02));
tuner_info(" B2 carrier mode : %s\n",
(buf[1] & 0x04) ? "QSS" : "Intercarrier");
tuner_info(" B3-4 tv sound/radio : %s\n",
sound[(buf[1] & 0x18) >> 3]);
tuner_info(" B5 force mute audio: %s\n",
- (buf[1] & 0x20) ? "yes" : "no");
+ str_yes_no(buf[1] & 0x20));
tuner_info(" B6 output port 1 : %s\n",
(buf[1] & 0x40) ? "high (inactive)" : "low (active)");
tuner_info(" B7 output port 2 : %s\n",
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/media/rc/mceusb.c:1130:2-8: opportunity for str_enable_disable(enable)
drivers/media/rc/ene_ir.c:1121:22-28: opportunity for str_enabled_disabled(enable)
drivers/media/rc/serial_ir.c:591:4-9: opportunity for str_low_high(sense)
drivers/media/rc/serial_ir.c:594:4-9: opportunity for str_low_high(sense)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/rc/ene_ir.c | 3 ++-
drivers/media/rc/mceusb.c | 3 ++-
drivers/media/rc/serial_ir.c | 5 +++--
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/media/rc/ene_ir.c b/drivers/media/rc/ene_ir.c
index 67722e2e47ff..90bee860a8a1 100644
--- a/drivers/media/rc/ene_ir.c
+++ b/drivers/media/rc/ene_ir.c
@@ -24,6 +24,7 @@
#include <linux/interrupt.h>
#include <linux/sched.h>
#include <linux/slab.h>
+#include <linux/string_choices.h>
#include <media/rc-core.h>
#include "ene_ir.h"
@@ -1118,7 +1119,7 @@ static void ene_remove(struct pnp_dev *pnp_dev)
/* enable wake on IR (wakes on specific button on original remote) */
static void ene_enable_wake(struct ene_device *dev, bool enable)
{
- dbg("wake on IR %s", enable ? "enabled" : "disabled");
+ dbg("wake on IR %s", str_enabled_disabled(enable));
ene_set_clear_reg_mask(dev, ENE_FW1, ENE_FW1_WAKE, enable);
}
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index cd7af4d88b7f..7f932f0f5750 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -25,6 +25,7 @@
#include <linux/device.h>
#include <linux/module.h>
#include <linux/slab.h>
+#include <linux/string_choices.h>
#include <linux/workqueue.h>
#include <linux/usb.h>
#include <linux/usb/input.h>
@@ -1127,7 +1128,7 @@ static int mceusb_set_rx_carrier_report(struct rc_dev *dev, int enable)
MCE_CMD_SETIRRXPORTEN, 0x00 };
dev_dbg(ir->dev, "%s short-range receiver carrier reporting",
- enable ? "enable" : "disable");
+ str_enable_disable(enable));
if (enable) {
ir->carrier_report_enabled = true;
if (!ir->learning_active) {
diff --git a/drivers/media/rc/serial_ir.c b/drivers/media/rc/serial_ir.c
index fc5fd3927177..f9ec2f043529 100644
--- a/drivers/media/rc/serial_ir.c
+++ b/drivers/media/rc/serial_ir.c
@@ -25,6 +25,7 @@
#include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/spinlock.h>
+#include <linux/string_choices.h>
#include <media/rc-core.h>
struct serial_ir_hw {
@@ -588,10 +589,10 @@ static int serial_ir_probe(struct platform_device *dev)
}
sense = nlow >= nhigh ? 1 : 0;
dev_info(&dev->dev, "auto-detected active %s receiver\n",
- sense ? "low" : "high");
+ str_low_high(sense));
} else
dev_info(&dev->dev, "Manually using active %s receiver\n",
- sense ? "low" : "high");
+ str_low_high(sense));
dev_dbg(&dev->dev, "Interrupt %d, port %04x obtained\n", irq, io);
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/media/dvb-frontends/cx24120.c:456:3-9: opportunity for str_enable_disable(enable)
drivers/media/dvb-frontends/cx24120.c:462:2-8: opportunity for str_enabled_disabled(enable)
drivers/media/dvb-frontends/helene.c:282:4-14: opportunity for str_read_write(write == 0)
drivers/media/dvb-frontends/cxd2841er.c:209:3-13: opportunity for str_read_write(write == 0)
drivers/media/dvb-frontends/drxk_hard.c:6282:22-28: opportunity for str_enable_disable(enable)
drivers/media/dvb-frontends/drxk_hard.c:1071:2-13: opportunity for str_enable_disable(mpeg_enable)
drivers/media/dvb-frontends/sp2.c:135:3-9: opportunity for str_read_write(( read ))
drivers/media/dvb-frontends/horus3a.c:41:3-13: opportunity for str_read_write(write == 0)
drivers/media/dvb-frontends/ascot2e.c:107:3-13: opportunity for str_read_write(write == 0)
drivers/media/usb/dvb-usb/af9005-fe.c:1282:27-31: opportunity for str_high_low(temp)
drivers/media/usb/dvb-usb/af9005-fe.c:790:30-32: opportunity for str_on_off(on)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
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 +-
7 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/media/dvb-frontends/ascot2e.c b/drivers/media/dvb-frontends/ascot2e.c
index cf8e5f1bd101..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",
- (write == 0 ? "read" : "write"), 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/cx24120.c b/drivers/media/dvb-frontends/cx24120.c
index 44515fdbe91d..a02aaebb091a 100644
--- a/drivers/media/dvb-frontends/cx24120.c
+++ b/drivers/media/dvb-frontends/cx24120.c
@@ -453,13 +453,13 @@ static int cx24120_msg_mpeg_output_global_config(struct cx24120_state *state,
ret = cx24120_message_send(state, &cmd);
if (ret != 0) {
dev_dbg(&state->i2c->dev, "failed to %s MPEG output\n",
- enable ? "enable" : "disable");
+ str_enable_disable(enable));
return ret;
}
state->mpeg_enabled = enable;
dev_dbg(&state->i2c->dev, "MPEG output %s\n",
- enable ? "enabled" : "disabled");
+ str_enabled_disabled(enable));
return 0;
}
diff --git a/drivers/media/dvb-frontends/cxd2841er.c b/drivers/media/dvb-frontends/cxd2841er.c
index d925ca24183b..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",
- (write == 0 ? "read" : "write"), addr, reg, len, len, data);
+ str_write_read(write), addr, reg, len, len, data);
}
static int cxd2841er_write_regs(struct cxd2841er_priv *priv,
diff --git a/drivers/media/dvb-frontends/drxk_hard.c b/drivers/media/dvb-frontends/drxk_hard.c
index 87f3d4f0eb8c..cbb1ba0f1323 100644
--- a/drivers/media/dvb-frontends/drxk_hard.c
+++ b/drivers/media/dvb-frontends/drxk_hard.c
@@ -1068,7 +1068,7 @@ static int mpegts_configure_pins(struct drxk_state *state, bool mpeg_enable)
u16 err_cfg = 0;
dprintk(1, ": mpeg %s, %s mode\n",
- mpeg_enable ? "enable" : "disable",
+ str_enable_disable(mpeg_enable),
state->m_enable_parallel ? "parallel" : "serial");
/* stop lock indicator process */
@@ -6279,7 +6279,7 @@ static int drxk_gate_ctrl(struct dvb_frontend *fe, int enable)
{
struct drxk_state *state = fe->demodulator_priv;
- dprintk(1, ": %s\n", enable ? "enable" : "disable");
+ dprintk(1, ": %s\n", str_enable_disable(enable));
if (state->m_drxk_state == DRXK_NO_DEV)
return -ENODEV;
diff --git a/drivers/media/dvb-frontends/helene.c b/drivers/media/dvb-frontends/helene.c
index f127adee3ebb..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",
- (write == 0 ? "read" : "write"), 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-frontends/horus3a.c
index 0330b78a5b3f..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",
- (write == 0 ? "read" : "write"), 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/dvb-frontends/sp2.c b/drivers/media/dvb-frontends/sp2.c
index 75adf2a4589f..0332e3c312c6 100644
--- a/drivers/media/dvb-frontends/sp2.c
+++ b/drivers/media/dvb-frontends/sp2.c
@@ -132,7 +132,7 @@ static int sp2_ci_op_cam(struct dvb_ca_en50221 *en50221, int slot, u8 acs,
return ret;
dev_dbg(&s->client->dev, "%s: slot=%d, addr=0x%04x, %s, data=%x",
- (read) ? "read" : "write", slot, addr,
+ str_read_write(read), slot, addr,
(acs == SP2_CI_ATTR_ACS) ? "attr" : "io",
(read) ? mem : data);
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/media/pci/cx23885/altera-ci.c:285:3-9: opportunity for str_read_write(( read ))
drivers/media/pci/cx23885/cimax2.c:227:3-9: opportunity for str_read_write(( read ))
drivers/media/pci/cx23885/cx23888-ir.c:996:4-9: opportunity for str_enabled_disabled(filtr)
drivers/media/pci/cx23885/cx23888-ir.c:935:4-21: opportunity for str_enabled_disabled(cntrl & CNTRL_DMD)
drivers/media/pci/cx23885/cx23888-ir.c:1020:4-21: opportunity for str_enabled_disabled(cntrl & CNTRL_MOD)
drivers/media/pci/cx23885/cx23888-ir.c:937:4-21: opportunity for str_enabled_disabled(cntrl & CNTRL_RFE)
drivers/media/pci/cx23885/cx23888-ir.c:1022:4-21: opportunity for str_enabled_disabled(cntrl & CNTRL_TFE)
drivers/media/pci/cx23885/cx23888-ir.c:1008:4-21: opportunity for str_enabled_disabled(irqen & IRQEN_ROE)
drivers/media/pci/cx23885/cx23888-ir.c:1014:4-21: opportunity for str_enabled_disabled(irqen & IRQEN_RSE)
drivers/media/pci/cx23885/cx23888-ir.c:1004:4-21: opportunity for str_enabled_disabled(irqen & IRQEN_RTE)
drivers/media/pci/cx23885/cx23888-ir.c:1044:4-21: opportunity for str_enabled_disabled(irqen & IRQEN_TSE)
drivers/media/pci/cx23885/cx23888-ir.c:1026:4-21: opportunity for str_yes_no(cntrl & CNTRL_IVO)
drivers/media/pci/cx23885/cx23888-ir.c:933:4-21: opportunity for str_yes_no(cntrl & CNTRL_RXE)
drivers/media/pci/cx23885/cx23888-ir.c:1018:4-21: opportunity for str_yes_no(cntrl & CNTRL_TXE)
drivers/media/pci/cx23885/cx23888-ir.c:1010:4-21: opportunity for str_yes_no(stats & STATS_RBY)
drivers/media/pci/cx23885/cx23888-ir.c:1006:4-21: opportunity for str_yes_no(stats & STATS_ROR)
drivers/media/pci/cx23885/cx23888-ir.c:1012:4-21: opportunity for str_yes_no(stats & STATS_RSR)
drivers/media/pci/cx23885/cx23888-ir.c:1002:4-21: opportunity for str_yes_no(stats & STATS_RTO)
drivers/media/pci/cx23885/cx23888-ir.c:1040:4-21: opportunity for str_yes_no(stats & STATS_TBY)
drivers/media/pci/cx23885/cx23888-ir.c:1042:4-21: opportunity for str_yes_no(stats & STATS_TSR)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/pci/cx23885/altera-ci.c | 2 +-
drivers/media/pci/cx23885/cimax2.c | 2 +-
drivers/media/pci/cx23885/cx23888-ir.c | 36 +++++++++++++++++-----------------
3 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/drivers/media/pci/cx23885/altera-ci.c b/drivers/media/pci/cx23885/altera-ci.c
index 0dc348215b72..e154a39d86ef 100644
--- a/drivers/media/pci/cx23885/altera-ci.c
+++ b/drivers/media/pci/cx23885/altera-ci.c
@@ -282,7 +282,7 @@ static int altera_ci_op_cam(struct dvb_ca_en50221 *en50221, int slot,
mutex_unlock(&inter->fpga_mutex);
ci_dbg_print("%s: %s: addr=[0x%02x], %s=%x\n", __func__,
- (read) ? "read" : "write", addr,
+ str_read_write(read), addr,
(flag == NETUP_CI_FLG_CTL) ? "ctl" : "mem",
(read) ? mem : val);
diff --git a/drivers/media/pci/cx23885/cimax2.c b/drivers/media/pci/cx23885/cimax2.c
index 06e41f92092d..458fa779274a 100644
--- a/drivers/media/pci/cx23885/cimax2.c
+++ b/drivers/media/pci/cx23885/cimax2.c
@@ -224,7 +224,7 @@ static int netup_ci_op_cam(struct dvb_ca_en50221 *en50221, int slot,
return -EREMOTEIO;
ci_dbg_print("%s: %s: chipaddr=[0x%x] addr=[0x%02x], %s=%x\n", __func__,
- (read) ? "read" : "write", state->ci_i2c_addr, addr,
+ str_read_write(read), state->ci_i2c_addr, addr,
(flag == NETUP_CI_CTL) ? "ctl" : "mem",
(read) ? mem : data);
diff --git a/drivers/media/pci/cx23885/cx23888-ir.c b/drivers/media/pci/cx23885/cx23888-ir.c
index 222d04421468..85ca564fd3ab 100644
--- a/drivers/media/pci/cx23885/cx23888-ir.c
+++ b/drivers/media/pci/cx23885/cx23888-ir.c
@@ -930,11 +930,11 @@ static int cx23888_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";
@@ -993,37 +993,37 @@ static int cx23888_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, "\tOutput pin level inversion %s\n",
- cntrl & CNTRL_IVO ? "yes" : "no");
+ str_yes_no(cntrl & CNTRL_IVO));
v4l2_info(sd, "\tCarrier polarity: %s\n",
cntrl & CNTRL_CPL ? "space:burst mark:noburst"
: "space:noburst mark:burst");
@@ -1037,11 +1037,11 @@ static int cx23888_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;
}
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/media/pci/saa7134/saa7134-cards.c:7984:7-16: opportunity for str_yes_no(( 1 == rc ))
drivers/media/pci/saa7134/saa7134-dvb.c:93:31-33: opportunity for str_on_off(ok)
drivers/media/pci/saa7134/saa7134-input.c:919:3-12: opportunity for str_yes_no(( rc == 1 ))
drivers/media/pci/saa7134/saa7134-input.c:898:3-12: opportunity for str_yes_no(( 1 == rc ))
drivers/media/pci/saa7134/saa7134-input.c:934:3-12: opportunity for str_yes_no(( 1 == rc ))
drivers/media/pci/saa7134/saa7134-video.c:622:10-15: opportunity for str_enabled_disabled(flags)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
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 +-
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/media/pci/saa7134/saa7134-cards.c b/drivers/media/pci/saa7134/saa7134-cards.c
index e80fb4ebfda6..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 = i2c_transfer(&dev->i2c_adap, &msg, 1);
pr_info("%s: probe IR chip @ i2c 0x%02x: %s\n",
dev->name, msg.addr,
- (1 == rc) ? "yes" : "no");
+ str_yes_no(rc == 1));
if (rc == 1)
dev->has_remote = SAA7134_REMOTE_I2C;
}
diff --git a/drivers/media/pci/saa7134/saa7134-dvb.c b/drivers/media/pci/saa7134/saa7134-dvb.c
index 6de8a02314af..d0e58a0156f7 100644
--- a/drivers/media/pci/saa7134/saa7134-dvb.c
+++ b/drivers/media/pci/saa7134/saa7134-dvb.c
@@ -90,7 +90,7 @@ static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on)
saa_setl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 28));
udelay(10);
ok = saa_readl(SAA7134_GPIO_GPSTATUS0) & (1 << 27);
- pr_debug("%s %s\n", __func__, ok ? "on" : "off");
+ pr_debug("%s %s\n", __func__, str_on_off(ok));
if (!ok)
saa_clearl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 26));
diff --git a/drivers/media/pci/saa7134/saa7134-input.c b/drivers/media/pci/saa7134/saa7134-input.c
index 8610eb473b39..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 = i2c_transfer(&dev->i2c_adap, &msg_msi, 1);
input_dbg("probe 0x%02x @ %s: %s\n",
msg_msi.addr, dev->i2c_adap.name,
- (1 == rc) ? "yes" : "no");
+ str_yes_no(rc == 1));
break;
case SAA7134_BOARD_SNAZIO_TVPVR_PRO:
dev->init_data.name = "SnaZio* TVPVR PRO";
@@ -916,7 +916,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev)
rc = i2c_transfer(&dev->i2c_adap, &msg_msi, 1);
input_dbg("probe 0x%02x @ %s: %s\n",
msg_msi.addr, dev->i2c_adap.name,
- (rc == 1) ? "yes" : "no");
+ str_yes_no(rc == 1));
break;
case SAA7134_BOARD_KWORLD_PC150U:
/* copied and modified from MSI TV@nywhere Plus */
@@ -931,7 +931,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev)
rc = i2c_transfer(&dev->i2c_adap, &msg_msi, 1);
input_dbg("probe 0x%02x @ %s: %s\n",
msg_msi.addr, dev->i2c_adap.name,
- (1 == rc) ? "yes" : "no");
+ str_yes_no(rc == 1));
break;
case SAA7134_BOARD_HAUPPAUGE_HVR1110:
dev->init_data.name = saa7134_boards[dev->board].name;
diff --git a/drivers/media/pci/saa7134/saa7134-video.c b/drivers/media/pci/saa7134/saa7134-video.c
index 56b4481a40e6..1c02fb04abdf 100644
--- a/drivers/media/pci/saa7134/saa7134-video.c
+++ b/drivers/media/pci/saa7134/saa7134-video.c
@@ -619,7 +619,7 @@ static int saa7134_enable_analog_tuner(struct saa7134_dev *dev)
if (ret) {
pr_err("Couldn't change link %s->%s to %s. Error %d\n",
source->name, sink->name,
- flags ? "enabled" : "disabled",
+ str_enabled_disabled(flags),
ret);
return ret;
}
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/media/platform/amphion/venc.c:1206:4-26: opportunity for str_enable_disable(venc -> params . rc_enable)
drivers/media/platform/amphion/vpu_dbg.c:259:3-34: opportunity for str_on_off(vpu_iface_get_power_state ( core ))
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/platform/amphion/venc.c | 2 +-
drivers/media/platform/amphion/vpu_dbg.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/amphion/venc.c b/drivers/media/platform/amphion/venc.c
index 351b4edc8742..789c8fca3d31 100644
--- a/drivers/media/platform/amphion/venc.c
+++ b/drivers/media/platform/amphion/venc.c
@@ -1203,7 +1203,7 @@ static int venc_get_debug_info(struct vpu_inst *inst, char *str, u32 size, u32 i
break;
case 8:
num = scnprintf(str, size, "rc: %s, mode = %d, bitrate = %d(%d), qp = %d\n",
- venc->params.rc_enable ? "enable" : "disable",
+ str_enable_disable(venc->params.rc_enable),
venc->params.rc_mode,
venc->params.bitrate,
venc->params.bitrate_max,
diff --git a/drivers/media/platform/amphion/vpu_dbg.c b/drivers/media/platform/amphion/vpu_dbg.c
index 940e5bda5fa3..2dbcef4e83ef 100644
--- a/drivers/media/platform/amphion/vpu_dbg.c
+++ b/drivers/media/platform/amphion/vpu_dbg.c
@@ -256,7 +256,7 @@ static int vpu_dbg_core(struct seq_file *s, void *data)
return 0;
num = scnprintf(str, sizeof(str), "power %s\n",
- vpu_iface_get_power_state(core) ? "on" : "off");
+ str_on_off(vpu_iface_get_power_state(core)));
if (seq_write(s, str, num))
return 0;
num = scnprintf(str, sizeof(str), "state = %d\n", core->state);
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/media/pci/ivtv/ivtvfb.c:809:3-57: opportunity for str_on_off(( var -> vmode & FB_VMODE_MASK ) == FB_VMODE_NONINTERLACED)
drivers/media/pci/ivtv/ivtvfb.c:609:3-57: opportunity for str_on_off(( var -> vmode & FB_VMODE_MASK ) == FB_VMODE_NONINTERLACED)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/pci/ivtv/ivtvfb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/pci/ivtv/ivtvfb.c b/drivers/media/pci/ivtv/ivtvfb.c
index 90c584cf97c2..bd07afc68191 100644
--- a/drivers/media/pci/ivtv/ivtvfb.c
+++ b/drivers/media/pci/ivtv/ivtvfb.c
@@ -606,7 +606,7 @@ static int ivtvfb_set_var(struct ivtv *itv, struct fb_var_screeninfo *var)
var->left_margin, var->upper_margin);
IVTVFB_DEBUG_INFO("Display filter: %s\n",
- (var->vmode & FB_VMODE_MASK) == FB_VMODE_NONINTERLACED ? "on" : "off");
+ str_on_off((var->vmode & FB_VMODE_MASK) == FB_VMODE_NONINTERLACED));
IVTVFB_DEBUG_INFO("Color space: %s\n", var->nonstd ? "YUV" : "RGB");
return 0;
@@ -806,7 +806,7 @@ static int _ivtvfb_check_var(struct fb_var_screeninfo *var, struct ivtv *itv)
var->left_margin, var->upper_margin);
IVTVFB_DEBUG_INFO("Display filter: %s\n",
- (var->vmode & FB_VMODE_MASK) == FB_VMODE_NONINTERLACED ? "on" : "off");
+ str_on_off((var->vmode & FB_VMODE_MASK) == FB_VMODE_NONINTERLACED));
IVTVFB_DEBUG_INFO("Color space: %s\n", var->nonstd ? "YUV" : "RGB");
return 0;
}
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/media/pci/bt8xx/bttv-driver.c:2988:5-31: opportunity for str_yes_no(dstat & BT848_DSTATUS_HLOC)
drivers/media/pci/bt8xx/bttv-driver.c:2992:5-31: opportunity for str_yes_no(dstat & BT848_DSTATUS_PRES)
drivers/media/pci/bt8xx/bttv-cards.c:3039:13-22: opportunity for str_yes_no(has_radio)
drivers/media/pci/bt8xx/bttv-cards.c:3040:2-12: opportunity for str_yes_no(has_remote)
drivers/media/pci/bt8xx/bttv-cards.c:3043:2-21: opportunity for str_yes_no(has_tda9820_tda9821)
drivers/media/pci/bt8xx/bttv-cards.c:3044:2-17: opportunity for str_yes_no(is_capture_only)
drivers/media/pci/bt8xx/bttv-cards.c:3042:13-20: opportunity for str_yes_no(is_lr90)
drivers/media/pci/bt8xx/bttv-cards.c:4080:8-19: opportunity for str_yes_no(tuner_tv_fm)
drivers/media/pci/bt8xx/bttv-cards.c:3140:24-38: opportunity for str_yes_no(btv -> has_radio)
drivers/media/pci/bt8xx/bttv-cards.c:4081:8-23: opportunity for str_yes_no(btv -> has_remote)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/pci/bt8xx/bttv-cards.c | 16 ++++++++--------
drivers/media/pci/bt8xx/bttv-driver.c | 6 ++----
2 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/drivers/media/pci/bt8xx/bttv-cards.c b/drivers/media/pci/bt8xx/bttv-cards.c
index 867c1308de23..f989b5ed28fd 100644
--- a/drivers/media/pci/bt8xx/bttv-cards.c
+++ b/drivers/media/pci/bt8xx/bttv-cards.c
@@ -3036,12 +3036,12 @@ static void flyvideo_gpio(struct bttv *btv)
tuner_type = TUNER_ABSENT; /* No tuner present */
pr_info("%d: FlyVideo Radio=%s RemoteControl=%s Tuner=%d gpio=0x%06x\n",
- btv->c.nr, has_radio ? "yes" : "no",
- has_remote ? "yes" : "no", tuner_type, gpio);
+ btv->c.nr, str_yes_no(has_radio),
+ str_yes_no(has_remote), tuner_type, gpio);
pr_info("%d: FlyVideo LR90=%s tda9821/tda9820=%s capture_only=%s\n",
- btv->c.nr, is_lr90 ? "yes" : "no",
- has_tda9820_tda9821 ? "yes" : "no",
- is_capture_only ? "yes" : "no");
+ btv->c.nr, str_yes_no(is_lr90),
+ str_yes_no(has_tda9820_tda9821),
+ str_yes_no(is_capture_only));
if (tuner_type != UNSET) /* only set if known tuner autodetected, else let insmod option through */
btv->tuner_type = tuner_type;
@@ -3137,7 +3137,7 @@ static void miro_pinnacle_gpio(struct bttv *btv)
if (-1 != msp)
btv->c.type = BTTV_BOARD_PINNACLEPRO;
pr_info("%d: pinnacle/mt: id=%d info=\"%s\" radio=%s\n",
- btv->c.nr, id, info, btv->has_radio ? "yes" : "no");
+ btv->c.nr, id, info, str_yes_no(btv->has_radio));
btv->tuner_type = TUNER_MT2032;
}
}
@@ -4077,8 +4077,8 @@ static void avermedia_eeprom(struct bttv *btv)
} else
pr_cont("Unknown type");
pr_cont(" radio:%s remote control:%s\n",
- tuner_tv_fm ? "yes" : "no",
- btv->has_remote ? "yes" : "no");
+ str_yes_no(tuner_tv_fm),
+ str_yes_no(btv->has_remote));
}
/*
diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c
index 511f013cc338..fdad666d3d0f 100644
--- a/drivers/media/pci/bt8xx/bttv-driver.c
+++ b/drivers/media/pci/bt8xx/bttv-driver.c
@@ -2985,12 +2985,10 @@ static irqreturn_t bttv_irq(int irq, void *dev_id)
bttv_print_irqbits(stat,astat);
if (stat & BT848_INT_HLOCK)
pr_cont(" HLOC => %s",
- dstat & BT848_DSTATUS_HLOC
- ? "yes" : "no");
+ str_yes_no(dstat & BT848_DSTATUS_HLOC));
if (stat & BT848_INT_VPRES)
pr_cont(" PRES => %s",
- dstat & BT848_DSTATUS_PRES
- ? "yes" : "no");
+ str_yes_no(dstat & BT848_DSTATUS_PRES));
if (stat & BT848_INT_FMTCHG)
pr_cont(" NUML => %s",
dstat & BT848_DSTATUS_NUML
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/media/platform/xilinx/xilinx-csi2rxss.c:415:3-27: opportunity for str_true_false(data & XCSI_CLKINFR_STOP)
drivers/media/platform/xilinx/xilinx-csi2rxss.c:409:3-24: opportunity for str_true_false(data & XCSI_CSR_RIPCD)
drivers/media/platform/xilinx/xilinx-csi2rxss.c:407:3-23: opportunity for str_true_false(data & XCSI_CSR_SLBF)
drivers/media/platform/xilinx/xilinx-csi2rxss.c:403:3-29: opportunity for str_true_false(data & XCSI_CSR_SPFIFOFULL)
drivers/media/platform/xilinx/xilinx-csi2rxss.c:405:3-27: opportunity for str_true_false(data & XCSI_CSR_SPFIFONE)
drivers/media/platform/xilinx/xilinx-csi2rxss.c:424:4-30: opportunity for str_true_false(data & XCSI_DLXINFR_SOTERR)
drivers/media/platform/xilinx/xilinx-csi2rxss.c:425:4-34: opportunity for str_true_false(data & XCSI_DLXINFR_SOTSYNCERR)
drivers/media/platform/xilinx/xilinx-csi2rxss.c:426:4-28: opportunity for str_true_false(data & XCSI_DLXINFR_STOP)
drivers/media/platform/xilinx/xilinx-csi2rxss.c:892:2-19: opportunity for str_enabled_disabled(xcsi2rxss -> en_vcx)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/platform/xilinx/xilinx-csi2rxss.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/media/platform/xilinx/xilinx-csi2rxss.c b/drivers/media/platform/xilinx/xilinx-csi2rxss.c
index f953d5474ae0..7ddd9b265162 100644
--- a/drivers/media/platform/xilinx/xilinx-csi2rxss.c
+++ b/drivers/media/platform/xilinx/xilinx-csi2rxss.c
@@ -400,19 +400,19 @@ static int xcsi2rxss_log_status(struct v4l2_subdev *sd)
dev_info(dev, "***** Core Status *****\n");
data = xcsi2rxss_read(xcsi2rxss, XCSI_CSR_OFFSET);
dev_info(dev, "Short Packet FIFO Full = %s\n",
- data & XCSI_CSR_SPFIFOFULL ? "true" : "false");
+ str_true_false(data & XCSI_CSR_SPFIFOFULL));
dev_info(dev, "Short Packet FIFO Not Empty = %s\n",
- data & XCSI_CSR_SPFIFONE ? "true" : "false");
+ str_true_false(data & XCSI_CSR_SPFIFONE));
dev_info(dev, "Stream line buffer full = %s\n",
- data & XCSI_CSR_SLBF ? "true" : "false");
+ str_true_false(data & XCSI_CSR_SLBF));
dev_info(dev, "Soft reset/Core disable in progress = %s\n",
- data & XCSI_CSR_RIPCD ? "true" : "false");
+ str_true_false(data & XCSI_CSR_RIPCD));
/* Clk & Lane Info */
dev_info(dev, "******** Clock Lane Info *********\n");
data = xcsi2rxss_read(xcsi2rxss, XCSI_CLKINFR_OFFSET);
dev_info(dev, "Clock Lane in Stop State = %s\n",
- data & XCSI_CLKINFR_STOP ? "true" : "false");
+ str_true_false(data & XCSI_CLKINFR_STOP));
dev_info(dev, "******** Data Lane Info *********\n");
dev_info(dev, "Lane\tSoT Error\tSoT Sync Error\tStop State\n");
@@ -421,9 +421,9 @@ static int xcsi2rxss_log_status(struct v4l2_subdev *sd)
data = xcsi2rxss_read(xcsi2rxss, reg);
dev_info(dev, "%d\t%s\t\t%s\t\t%s\n", i,
- data & XCSI_DLXINFR_SOTERR ? "true" : "false",
- data & XCSI_DLXINFR_SOTSYNCERR ? "true" : "false",
- data & XCSI_DLXINFR_STOP ? "true" : "false");
+ str_true_false(data & XCSI_DLXINFR_SOTERR),
+ str_true_false(data & XCSI_DLXINFR_SOTSYNCERR),
+ str_true_false(data & XCSI_DLXINFR_STOP));
reg += XCSI_NEXTREG_OFFSET;
}
@@ -889,7 +889,7 @@ static int xcsi2rxss_parse_of(struct xcsi2rxss_state *xcsi2rxss)
fwnode_handle_put(ep);
dev_dbg(dev, "vcx %s, %u data lanes (%s), data type 0x%02x\n",
- xcsi2rxss->en_vcx ? "enabled" : "disabled",
+ str_enabled_disabled(xcsi2rxss->en_vcx),
xcsi2rxss->max_num_lanes,
xcsi2rxss->enable_active_lanes ? "dynamic" : "static",
xcsi2rxss->datatype);
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warning is fixed:
drivers/media/platform/ti/omap3isp/ispstat.c:771:21-27: opportunity for str_enable_disable(enable)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/platform/ti/omap3isp/ispstat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/platform/ti/omap3isp/ispstat.c b/drivers/media/platform/ti/omap3isp/ispstat.c
index 359a846205b0..603439afe582 100644
--- a/drivers/media/platform/ti/omap3isp/ispstat.c
+++ b/drivers/media/platform/ti/omap3isp/ispstat.c
@@ -768,7 +768,7 @@ int omap3isp_stat_enable(struct ispstat *stat, u8 enable)
unsigned long irqflags;
dev_dbg(stat->isp->dev, "%s: user wants to %s module.\n",
- stat->subdev.name, enable ? "enable" : "disable");
+ stat->subdev.name, str_enable_disable(enable));
/* Prevent enabling while configuring */
mutex_lock(&stat->ioctl_lock);
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/media/platform/st/sti/hva/hva-debugfs.c:74:9-22: opportunity for str_true_false(ctrls -> dct8x8)
drivers/media/platform/st/sti/hva/hva-debugfs.c:79:9-22: opportunity for str_true_false(ctrls -> sei_fp)
drivers/media/platform/st/sti/hva/hva-debugfs.c:77:9-23: opportunity for str_true_false(ctrls -> vui_sar)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/platform/st/sti/hva/hva-debugfs.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/st/sti/hva/hva-debugfs.c b/drivers/media/platform/st/sti/hva/hva-debugfs.c
index a86a07b6fbc7..5e8c7dddbabf 100644
--- a/drivers/media/platform/st/sti/hva/hva-debugfs.c
+++ b/drivers/media/platform/st/sti/hva/hva-debugfs.c
@@ -71,12 +71,12 @@ static void format_ctx(struct seq_file *s, struct hva_ctx *ctx)
" | |- SEI frame packing type=%s\n",
v4l2_ctrl_get_menu(entropy)[ctrls->entropy_mode],
ctrls->cpb_size,
- ctrls->dct8x8 ? "true" : "false",
+ str_true_false(ctrls->dct8x8),
ctrls->qpmin,
ctrls->qpmax,
- ctrls->vui_sar ? "true" : "false",
+ str_true_false(ctrls->vui_sar),
v4l2_ctrl_get_menu(vui_sar)[ctrls->vui_sar_idc],
- ctrls->sei_fp ? "true" : "false",
+ str_true_false(ctrls->sei_fp),
v4l2_ctrl_get_menu(sei_fp)[ctrls->sei_fp_type]);
}
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warning is fixed:
drivers/media/platform/chips-media/coda/imx-vdoa.c:120:39-42: opportunity for str_write_read(val)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/platform/chips-media/coda/imx-vdoa.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/chips-media/coda/imx-vdoa.c b/drivers/media/platform/chips-media/coda/imx-vdoa.c
index c3561fcecb98..abdff181d417 100644
--- a/drivers/media/platform/chips-media/coda/imx-vdoa.c
+++ b/drivers/media/platform/chips-media/coda/imx-vdoa.c
@@ -15,6 +15,7 @@
#include <linux/platform_device.h>
#include <linux/videodev2.h>
#include <linux/slab.h>
+#include <linux/string_choices.h>
#include "imx-vdoa.h"
@@ -117,7 +118,7 @@ static irqreturn_t vdoa_irq_handler(int irq, void *data)
writel(val, vdoa->regs + VDOAIST);
if (val & VDOAIST_TERR) {
val = readl(vdoa->regs + VDOASR) & VDOASR_ERRW;
- dev_err(vdoa->dev, "AXI %s error\n", val ? "write" : "read");
+ dev_err(vdoa->dev, "AXI %s error\n", str_write_read(val));
} else if (!(val & VDOAIST_EOT)) {
dev_warn(vdoa->dev, "Spurious interrupt\n");
}
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/media/platform/aspeed/aspeed-video.c:1944:6-16: opportunity for str_on_off(v -> hq_mode)
drivers/media/platform/aspeed/aspeed-video.c:1230:3-17: opportunity for str_on_off(video -> hq_mode)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/platform/aspeed/aspeed-video.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/aspeed/aspeed-video.c b/drivers/media/platform/aspeed/aspeed-video.c
index fc6050e3be0d..9c4a47d7a442 100644
--- a/drivers/media/platform/aspeed/aspeed-video.c
+++ b/drivers/media/platform/aspeed/aspeed-video.c
@@ -1227,7 +1227,7 @@ static void aspeed_video_update_regs(struct aspeed_video *video)
v4l2_dbg(1, debug, &video->v4l2_dev, "compression quality(%d)\n",
video->jpeg_quality);
v4l2_dbg(1, debug, &video->v4l2_dev, "hq_mode(%s) hq_quality(%d)\n",
- video->hq_mode ? "on" : "off", video->jpeg_hq_quality);
+ str_on_off(video->hq_mode), video->jpeg_hq_quality);
if (video->format == VIDEO_FMT_ASPEED)
aspeed_video_update(video, VE_BCD_CTRL, 0, VE_BCD_CTRL_EN_BCD);
@@ -1941,7 +1941,7 @@ static int aspeed_video_debugfs_show(struct seq_file *s, void *data)
seq_printf(s, " %-20s:\t%d\n", "Quality", v->jpeg_quality);
if (v->format == VIDEO_FMT_ASPEED) {
seq_printf(s, " %-20s:\t%s\n", "HQ Mode",
- v->hq_mode ? "on" : "off");
+ str_on_off(v->hq_mode));
seq_printf(s, " %-20s:\t%d\n", "HQ Quality",
v->hq_mode ? v->jpeg_hq_quality : 0);
}
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warning is fixed:
drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c:247:51-57: opportunity for str_on_off(enable)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c b/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c
index 051898ce53f4..522dbf52c82b 100644
--- a/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c
+++ b/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c
@@ -244,7 +244,7 @@ static int ipu6_isys_csi2_set_stream(struct v4l2_subdev *sd,
u32 mask = 0;
u32 i;
- dev_dbg(dev, "stream %s CSI2-%u with %u lanes\n", enable ? "on" : "off",
+ dev_dbg(dev, "stream %s CSI2-%u with %u lanes\n", str_on_off(enable),
csi2->port, nlanes);
cfg.port = csi2->port;
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/media/pci/cx18/cx18-av-core.c:1013:40-46: opportunity for str_enable_disable(enable)
drivers/media/pci/cx18/cx18-av-core.c:1118:8-24: opportunity for str_yes_no(( mute_ctl & 0x2 ))
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/pci/cx18/cx18-av-core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/pci/cx18/cx18-av-core.c b/drivers/media/pci/cx18/cx18-av-core.c
index ee6e71157786..5701abdf9427 100644
--- a/drivers/media/pci/cx18/cx18-av-core.c
+++ b/drivers/media/pci/cx18/cx18-av-core.c
@@ -1010,7 +1010,7 @@ static int cx18_av_s_stream(struct v4l2_subdev *sd, int enable)
{
struct cx18 *cx = v4l2_get_subdevdata(sd);
- CX18_DEBUG_INFO_DEV(sd, "%s output\n", enable ? "enable" : "disable");
+ CX18_DEBUG_INFO_DEV(sd, "%s output\n", str_enable_disable(enable));
if (enable) {
cx18_av_write(cx, 0x115, 0x8c);
cx18_av_write(cx, 0x116, 0x07);
@@ -1115,7 +1115,7 @@ static void log_audio_status(struct cx18 *cx)
}
CX18_INFO_DEV(sd, "Detected audio standard: %s\n", p);
CX18_INFO_DEV(sd, "Audio muted: %s\n",
- (mute_ctl & 0x2) ? "yes" : "no");
+ str_yes_no(mute_ctl & 0x2));
CX18_INFO_DEV(sd, "Audio microcontroller: %s\n",
(download_ctl & 0x10) ? "running" : "stopped");
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warning is fixed:
drivers/media/pci/cobalt/cobalt-driver.c:263:25-33: opportunity for str_enable_disable(ctrl & 1)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/pci/cobalt/cobalt-driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/pci/cobalt/cobalt-driver.c b/drivers/media/pci/cobalt/cobalt-driver.c
index 6e1a0614e6d0..cff2d29410d4 100644
--- a/drivers/media/pci/cobalt/cobalt-driver.c
+++ b/drivers/media/pci/cobalt/cobalt-driver.c
@@ -260,7 +260,7 @@ static void msi_config_show(struct cobalt *cobalt, struct pci_dev *pci_dev)
u32 adrs_l, adrs_h;
pci_read_config_word(pci_dev, 0x52, &ctrl);
- cobalt_info("MSI %s\n", ctrl & 1 ? "enable" : "disable");
+ cobalt_info("MSI %s\n", str_enable_disable(ctrl & 1));
cobalt_info("MSI multiple message: Capable %u. Enable %u\n",
(1 << ((ctrl >> 1) & 7)), (1 << ((ctrl >> 4) & 7)));
if (ctrl & 0x80)
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/media/common/videobuf2/videobuf2-core.c:3008:2-6: opportunity for str_read_write(read)
drivers/media/common/videobuf2/videobuf2-core.c:2860:2-8: opportunity for str_read_write(( read ))
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/common/videobuf2/videobuf2-core.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c
index 29a8d876e6c2..05678fa14fe9 100644
--- a/drivers/media/common/videobuf2/videobuf2-core.c
+++ b/drivers/media/common/videobuf2/videobuf2-core.c
@@ -2857,7 +2857,8 @@ static int __vb2_init_fileio(struct vb2_queue *q, int read)
return -EBUSY;
dprintk(q, 3, "setting up file io: mode %s, count %d, read_once %d, write_immediately %d\n",
- (read) ? "read" : "write", q->min_reqbufs_allocation, q->fileio_read_once,
+ str_read_write(read), q->min_reqbufs_allocation,
+ q->fileio_read_once,
q->fileio_write_immediately);
fileio = kzalloc(sizeof(*fileio), GFP_KERNEL);
@@ -3005,7 +3006,7 @@ static size_t __vb2_perform_fileio(struct vb2_queue *q, char __user *data, size_
int ret;
dprintk(q, 3, "mode %s, offset %ld, count %zd, %sblocking\n",
- read ? "read" : "write", (long)*ppos, count,
+ str_read_write(read), (long)*ppos, count,
nonblock ? "non" : "");
if (!data)
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/media/cec/usb/pulse8/pulse8-cec.c:698:2-9: opportunity for str_on_off(data [ 0 ])
drivers/media/cec/usb/pulse8/pulse8-cec.c:705:4-11: opportunity for str_on_off(data [ 0 ])
drivers/media/cec/platform/cec-gpio/cec-gpio.c:138:6-22: opportunity for str_high_low(cec -> hpd_is_high)
drivers/media/cec/platform/cec-gpio/cec-gpio.c:141:6-21: opportunity for str_high_low(cec -> v5_is_high)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/cec/platform/cec-gpio/cec-gpio.c | 4 ++--
drivers/media/cec/usb/pulse8/pulse8-cec.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/media/cec/platform/cec-gpio/cec-gpio.c b/drivers/media/cec/platform/cec-gpio/cec-gpio.c
index 98dacb0919b6..49160a15272b 100644
--- a/drivers/media/cec/platform/cec-gpio/cec-gpio.c
+++ b/drivers/media/cec/platform/cec-gpio/cec-gpio.c
@@ -135,10 +135,10 @@ static void cec_gpio_status(struct cec_adapter *adap, struct seq_file *file)
seq_printf(file, "using irq: %d\n", cec->cec_irq);
if (cec->hpd_gpio)
seq_printf(file, "hpd: %s\n",
- cec->hpd_is_high ? "high" : "low");
+ str_high_low(cec->hpd_is_high));
if (cec->v5_gpio)
seq_printf(file, "5V: %s\n",
- cec->v5_is_high ? "high" : "low");
+ str_high_low(cec->v5_is_high));
}
static int cec_gpio_read_hpd(struct cec_adapter *adap)
diff --git a/drivers/media/cec/usb/pulse8/pulse8-cec.c b/drivers/media/cec/usb/pulse8/pulse8-cec.c
index ba67587bd43e..0167f21cb116 100644
--- a/drivers/media/cec/usb/pulse8/pulse8-cec.c
+++ b/drivers/media/cec/usb/pulse8/pulse8-cec.c
@@ -695,14 +695,14 @@ static int pulse8_setup(struct pulse8 *pulse8, struct serio *serio,
return err;
pulse8->autonomous = data[0];
dev_dbg(pulse8->dev, "Autonomous mode: %s",
- data[0] ? "on" : "off");
+ str_on_off(data[0]));
if (pulse8->vers >= 10) {
cmd[0] = MSGCODE_GET_AUTO_POWER_ON;
err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 1);
if (!err)
dev_dbg(pulse8->dev, "Auto Power On: %s",
- data[0] ? "on" : "off");
+ str_on_off(data[0]));
}
cmd[0] = MSGCODE_GET_DEVICE_TYPE;
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/media/common/b2c2/flexcop-hw-filter.c:119:20-25: opportunity for str_on_off(onoff)
drivers/media/common/b2c2/flexcop-hw-filter.c:12:35-40: opportunity for str_on_off(onoff)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/common/b2c2/flexcop-hw-filter.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/common/b2c2/flexcop-hw-filter.c b/drivers/media/common/b2c2/flexcop-hw-filter.c
index c5a3345c99e9..d64a03452e22 100644
--- a/drivers/media/common/b2c2/flexcop-hw-filter.c
+++ b/drivers/media/common/b2c2/flexcop-hw-filter.c
@@ -9,7 +9,7 @@
static void flexcop_rcv_data_ctrl(struct flexcop_device *fc, int onoff)
{
flexcop_set_ibi_value(ctrl_208, Rcv_Data_sig, onoff);
- deb_ts("rcv_data is now: '%s'\n", onoff ? "on" : "off");
+ deb_ts("rcv_data is now: '%s'\n", str_on_off(onoff));
}
void flexcop_smc_ctrl(struct flexcop_device *fc, int onoff)
@@ -116,7 +116,7 @@ static void flexcop_pid_control(struct flexcop_device *fc,
return;
deb_ts("setting pid: %5d %04x at index %d '%s'\n",
- pid, pid, index, onoff ? "on" : "off");
+ pid, pid, index, str_on_off(onoff));
/* First 6 can be buggy - skip over them if option set */
if (fc->skip_6_hw_pid_filter)
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warning is fixed:
drivers/media/common/siano/sms-cards.c:329:36-41: opportunity for str_enabled_disabled(onoff)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/common/siano/sms-cards.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/media/common/siano/sms-cards.c b/drivers/media/common/siano/sms-cards.c
index d4a116ab6c88..e9aa95233ff1 100644
--- a/drivers/media/common/siano/sms-cards.c
+++ b/drivers/media/common/siano/sms-cards.c
@@ -8,6 +8,7 @@
#include "sms-cards.h"
#include "smsir.h"
#include <linux/module.h>
+#include <linux/string_choices.h>
static struct sms_board sms_boards[] = {
[SMS_BOARD_UNKNOWN] = {
@@ -326,7 +327,7 @@ int sms_board_lna_control(struct smscore_device_t *coredev, int onoff)
int board_id = smscore_get_board_id(coredev);
struct sms_board *board = sms_get_board(board_id);
- pr_debug("%s: LNA %s\n", __func__, onoff ? "enabled" : "disabled");
+ pr_debug("%s: LNA %s\n", __func__, str_enabled_disabled(onoff));
switch (board_id) {
case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2:
--
2.46.1.824.gd892dcdcdd-goog
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 <ribalda@chromium.org>
---
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;
}
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warning is fixed:
drivers/media/i2c/vpx3220.c:404:41-47: opportunity for str_on_off(enable)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/i2c/vpx3220.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/i2c/vpx3220.c b/drivers/media/i2c/vpx3220.c
index 5f1a22284168..c5b031dd59e7 100644
--- a/drivers/media/i2c/vpx3220.c
+++ b/drivers/media/i2c/vpx3220.c
@@ -401,7 +401,7 @@ static int vpx3220_s_routing(struct v4l2_subdev *sd,
static int vpx3220_s_stream(struct v4l2_subdev *sd, int enable)
{
- v4l2_dbg(1, debug, sd, "s_stream %s\n", enable ? "on" : "off");
+ v4l2_dbg(1, debug, sd, "s_stream %s\n", str_on_off(enable));
vpx3220_write(sd, 0xf2, (enable ? 0x1b : 0x00));
return 0;
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warning is fixed:
drivers/media/i2c/tvp7002.c:775:5-22: opportunity for str_yes_no(device -> streaming)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/i2c/tvp7002.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c
index c09a5bd71fd0..2acf93a90c34 100644
--- a/drivers/media/i2c/tvp7002.c
+++ b/drivers/media/i2c/tvp7002.c
@@ -772,7 +772,7 @@ static int tvp7002_log_status(struct v4l2_subdev *sd)
bt->width, bt->height);
}
v4l2_info(sd, "Streaming enabled: %s\n",
- device->streaming ? "yes" : "no");
+ str_yes_no(device->streaming));
/* Print the current value of the gain control */
v4l2_ctrl_handler_log_status(&device->hdl, sd->name);
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/media/i2c/ths8200.c:133:4-19: opportunity for str_enabled_disabled(( reg_03 & 0x20 ))
drivers/media/i2c/ths8200.c:149:52-54: opportunity for str_on_off(on)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/i2c/ths8200.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/i2c/ths8200.c b/drivers/media/i2c/ths8200.c
index 686f10641c7a..a6d2fb64f563 100644
--- a/drivers/media/i2c/ths8200.c
+++ b/drivers/media/i2c/ths8200.c
@@ -130,7 +130,7 @@ static int ths8200_log_status(struct v4l2_subdev *sd)
v4l2_info(sd, "power: %s\n", (reg_03 & 0x0c) ? "off" : "on");
v4l2_info(sd, "reset: %s\n", (reg_03 & 0x01) ? "off" : "on");
v4l2_info(sd, "test pattern: %s\n",
- (reg_03 & 0x20) ? "enabled" : "disabled");
+ str_enabled_disabled(reg_03 & 0x20));
v4l2_info(sd, "format: %ux%u\n",
ths8200_read(sd, THS8200_DTG2_PIXEL_CNT_MSB) * 256 +
ths8200_read(sd, THS8200_DTG2_PIXEL_CNT_LSB),
@@ -146,7 +146,7 @@ static int ths8200_s_power(struct v4l2_subdev *sd, int on)
{
struct ths8200_state *state = to_state(sd);
- v4l2_dbg(1, debug, sd, "%s: power %s\n", __func__, on ? "on" : "off");
+ v4l2_dbg(1, debug, sd, "%s: power %s\n", __func__, str_on_off(on));
state->power_on = on;
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/media/i2c/tda1997x.c:1976:4-29: opportunity for str_yes_no(tda1997x_detect_tx_5v ( sd ))
drivers/media/i2c/tda1997x.c:1978:4-30: opportunity for str_yes_no(tda1997x_detect_tx_hpd ( sd ))
drivers/media/i2c/tda1997x.c:1972:37-56: opportunity for str_yes_no(state -> edid . present)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/i2c/tda1997x.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/media/i2c/tda1997x.c b/drivers/media/i2c/tda1997x.c
index 3b7e5ff5b010..867c635fa37f 100644
--- a/drivers/media/i2c/tda1997x.c
+++ b/drivers/media/i2c/tda1997x.c
@@ -1969,13 +1969,13 @@ static int tda1997x_log_status(struct v4l2_subdev *sd)
v4l2_info(sd, "-----Chip status-----\n");
v4l2_info(sd, "Chip: %s N%d\n", state->info->name,
state->chip_revision + 1);
- v4l2_info(sd, "EDID Enabled: %s\n", state->edid.present ? "yes" : "no");
+ v4l2_info(sd, "EDID Enabled: %s\n", str_yes_no(state->edid.present));
v4l2_info(sd, "-----Signal status-----\n");
v4l2_info(sd, "Cable detected (+5V power): %s\n",
- tda1997x_detect_tx_5v(sd) ? "yes" : "no");
+ str_yes_no(tda1997x_detect_tx_5v(sd)));
v4l2_info(sd, "HPD detected: %s\n",
- tda1997x_detect_tx_hpd(sd) ? "yes" : "no");
+ str_yes_no(tda1997x_detect_tx_hpd(sd)));
v4l2_info(sd, "-----Video Timings-----\n");
switch (tda1997x_detect_std(state, &timings)) {
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/media/i2c/tc358743.c:370:46-52: opportunity for str_enable_disable(enable)
drivers/media/i2c/tc358743.c:1325:32-63: opportunity for str_on_off(hdmi_sys_status & MASK_S_AVMUTE)
drivers/media/i2c/tc358743.c:1264:35-54: opportunity for str_on_off(sysctl & MASK_SLEEP)
drivers/media/i2c/tc358743.c:1187:14-19: opportunity for str_yes_no(tx_5v)
drivers/media/i2c/tc358743.c:1266:3-33: opportunity for str_yes_no(hdmi_sys_status & MASK_S_DDC5V)
drivers/media/i2c/tc358743.c:1319:3-32: opportunity for str_yes_no(hdmi_sys_status & MASK_S_HDCP)
drivers/media/i2c/tc358743.c:1281:3-35: opportunity for str_yes_no(hdmi_sys_status & MASK_S_PHY_PLL)
drivers/media/i2c/tc358743.c:1283:3-36: opportunity for str_yes_no(hdmi_sys_status & MASK_S_PHY_SCDT)
drivers/media/i2c/tc358743.c:1279:3-32: opportunity for str_yes_no(hdmi_sys_status & MASK_S_SYNC)
drivers/media/i2c/tc358743.c:1277:3-32: opportunity for str_yes_no(hdmi_sys_status & MASK_S_TMDS)
drivers/media/i2c/tc358743.c:1274:3-37: opportunity for str_yes_no(( i2c_rd16 ( sd , CECEN ) & MASK_CECEN ))
drivers/media/i2c/tc358743.c:1309:3-42: opportunity for str_yes_no(( i2c_rd16 ( sd , CSI_STATUS ) & MASK_S_HLT ))
drivers/media/i2c/tc358743.c:1306:3-44: opportunity for str_yes_no(( i2c_rd16 ( sd , CSI_STATUS ) & MASK_S_RXACT ))
drivers/media/i2c/tc358743.c:1303:3-44: opportunity for str_yes_no(( i2c_rd16 ( sd , CSI_STATUS ) & MASK_S_TXACT ))
drivers/media/i2c/tc358743.c:1300:3-44: opportunity for str_yes_no(( i2c_rd16 ( sd , CSI_STATUS ) & MASK_S_WSYNC ))
drivers/media/i2c/tc358743.c:1268:3-50: opportunity for str_yes_no(( i2c_rd8 ( sd , EDID_MODE ) & MASK_EDID_MODE_E_DDC ))
drivers/media/i2c/tc358743.c:1271:3-41: opportunity for str_yes_no(( i2c_rd8 ( sd , HPD_CTL ) & MASK_HPD_OUT0 ))
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/i2c/tc358743.c | 44 +++++++++++++++++++-------------------------
1 file changed, 19 insertions(+), 25 deletions(-)
diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
index 65d58ddf0287..f2e1e55ae190 100644
--- a/drivers/media/i2c/tc358743.c
+++ b/drivers/media/i2c/tc358743.c
@@ -367,8 +367,8 @@ static void tc358743_delayed_work_enable_hotplug(struct work_struct *work)
static void tc358743_set_hdmi_hdcp(struct v4l2_subdev *sd, bool enable)
{
- v4l2_dbg(2, debug, sd, "%s: %s\n", __func__, enable ?
- "enable" : "disable");
+ v4l2_dbg(2, debug, sd, "%s: %s\n", __func__,
+ str_enable_disable(enable));
if (enable) {
i2c_wr8_and_or(sd, HDCP_REG3, ~KEY_RD_CMD, KEY_RD_CMD);
@@ -1184,7 +1184,7 @@ static void tc358743_hdmi_sys_int_handler(struct v4l2_subdev *sd, bool *handled)
bool tx_5v = tx_5v_power_present(sd);
v4l2_dbg(1, debug, sd, "%s: Tx 5V power present: %s\n",
- __func__, tx_5v ? "yes" : "no");
+ __func__, str_yes_no(tx_5v));
if (tx_5v) {
tc358743_enable_edid(sd);
@@ -1261,26 +1261,24 @@ static int tc358743_log_status(struct v4l2_subdev *sd)
!!(sysctl & MASK_CECRST),
!!(sysctl & MASK_CTXRST),
!!(sysctl & MASK_HDMIRST));
- v4l2_info(sd, "Sleep mode: %s\n", sysctl & MASK_SLEEP ? "on" : "off");
+ v4l2_info(sd, "Sleep mode: %s\n", str_on_off(sysctl & MASK_SLEEP));
v4l2_info(sd, "Cable detected (+5V power): %s\n",
- hdmi_sys_status & MASK_S_DDC5V ? "yes" : "no");
+ str_yes_no(hdmi_sys_status & MASK_S_DDC5V));
v4l2_info(sd, "DDC lines enabled: %s\n",
- (i2c_rd8(sd, EDID_MODE) & MASK_EDID_MODE_E_DDC) ?
- "yes" : "no");
+ str_yes_no(i2c_rd8(sd, EDID_MODE) & MASK_EDID_MODE_E_DDC));
v4l2_info(sd, "Hotplug enabled: %s\n",
- (i2c_rd8(sd, HPD_CTL) & MASK_HPD_OUT0) ?
- "yes" : "no");
+ str_yes_no(i2c_rd8(sd, HPD_CTL) & MASK_HPD_OUT0));
v4l2_info(sd, "CEC enabled: %s\n",
- (i2c_rd16(sd, CECEN) & MASK_CECEN) ? "yes" : "no");
+ str_yes_no(i2c_rd16(sd, CECEN) & MASK_CECEN));
v4l2_info(sd, "-----Signal status-----\n");
v4l2_info(sd, "TMDS signal detected: %s\n",
- hdmi_sys_status & MASK_S_TMDS ? "yes" : "no");
+ str_yes_no(hdmi_sys_status & MASK_S_TMDS));
v4l2_info(sd, "Stable sync signal: %s\n",
- hdmi_sys_status & MASK_S_SYNC ? "yes" : "no");
+ str_yes_no(hdmi_sys_status & MASK_S_SYNC));
v4l2_info(sd, "PHY PLL locked: %s\n",
- hdmi_sys_status & MASK_S_PHY_PLL ? "yes" : "no");
+ str_yes_no(hdmi_sys_status & MASK_S_PHY_PLL));
v4l2_info(sd, "PHY DE detected: %s\n",
- hdmi_sys_status & MASK_S_PHY_SCDT ? "yes" : "no");
+ str_yes_no(hdmi_sys_status & MASK_S_PHY_SCDT));
if (tc358743_get_detected_timings(sd, &timings)) {
v4l2_info(sd, "No video detected\n");
@@ -1297,17 +1295,13 @@ static int tc358743_log_status(struct v4l2_subdev *sd)
v4l2_info(sd, "Lanes in use: %d\n",
state->csi_lanes_in_use);
v4l2_info(sd, "Waiting for particular sync signal: %s\n",
- (i2c_rd16(sd, CSI_STATUS) & MASK_S_WSYNC) ?
- "yes" : "no");
+ str_yes_no(i2c_rd16(sd, CSI_STATUS) & MASK_S_WSYNC));
v4l2_info(sd, "Transmit mode: %s\n",
- (i2c_rd16(sd, CSI_STATUS) & MASK_S_TXACT) ?
- "yes" : "no");
+ str_yes_no(i2c_rd16(sd, CSI_STATUS) & MASK_S_TXACT));
v4l2_info(sd, "Receive mode: %s\n",
- (i2c_rd16(sd, CSI_STATUS) & MASK_S_RXACT) ?
- "yes" : "no");
+ str_yes_no(i2c_rd16(sd, CSI_STATUS) & MASK_S_RXACT));
v4l2_info(sd, "Stopped: %s\n",
- (i2c_rd16(sd, CSI_STATUS) & MASK_S_HLT) ?
- "yes" : "no");
+ str_yes_no(i2c_rd16(sd, CSI_STATUS) & MASK_S_HLT));
v4l2_info(sd, "Color space: %s\n",
state->mbus_fmt_code == MEDIA_BUS_FMT_UYVY8_1X16 ?
"YCbCr 422 16-bit" :
@@ -1316,14 +1310,14 @@ static int tc358743_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_sys_status & MASK_S_HDCP ? "yes" : "no");
+ str_yes_no(hdmi_sys_status & MASK_S_HDCP));
v4l2_info(sd, "Input color space: %s %s range\n",
input_color_space[(vi_status3 & MASK_S_V_COLOR) >> 1],
(vi_status3 & MASK_LIMITED) ? "limited" : "full");
if (!is_hdmi(sd))
return 0;
- v4l2_info(sd, "AV Mute: %s\n", hdmi_sys_status & MASK_S_AVMUTE ? "on" :
- "off");
+ v4l2_info(sd, "AV Mute: %s\n",
+ str_on_off(hdmi_sys_status & MASK_S_AVMUTE));
v4l2_info(sd, "Deep color mode: %d-bits per channel\n",
deep_color_mode[(i2c_rd8(sd, VI_STATUS1) &
MASK_S_DEEPCOLOR) >> 2]);
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warning is fixed:
drivers/media/i2c/st-mipid02.c:552:3-9: opportunity for str_enable_disable(enable)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/i2c/st-mipid02.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/i2c/st-mipid02.c b/drivers/media/i2c/st-mipid02.c
index b947a55281f0..70a691504eed 100644
--- a/drivers/media/i2c/st-mipid02.c
+++ b/drivers/media/i2c/st-mipid02.c
@@ -549,7 +549,7 @@ static int mipid02_s_stream(struct v4l2_subdev *sd, int enable)
mipid02_stream_disable(bridge);
if (ret)
dev_err(&client->dev, "failed to stream %s (%d)\n",
- enable ? "enable" : "disable", ret);
+ str_enable_disable(enable), ret);
return ret;
}
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/media/i2c/msp3400-driver.c:341:4-21: opportunity for str_on_off(state -> muted -> val)
drivers/media/i2c/msp3400-driver.c:342:4-27: opportunity for str_yes_no(state -> scan_in_progress)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/i2c/msp3400-driver.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/i2c/msp3400-driver.c b/drivers/media/i2c/msp3400-driver.c
index 4c0b0ad68c08..c7807b17add9 100644
--- a/drivers/media/i2c/msp3400-driver.c
+++ b/drivers/media/i2c/msp3400-driver.c
@@ -338,8 +338,8 @@ static int msp_s_ctrl(struct v4l2_ctrl *ctrl)
val = (val * 0x7f / 65535) << 8;
dev_dbg_lvl(&client->dev, 1, msp_debug, "mute=%s scanning=%s volume=%d\n",
- state->muted->val ? "on" : "off",
- state->scan_in_progress ? "yes" : "no",
+ str_on_off(state->muted->val),
+ str_yes_no(state->scan_in_progress),
state->volume->val);
msp_write_dsp(client, 0x0000, val);
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/media/i2c/max9286.c:1333:3-9: opportunity for str_on_off(enable)
drivers/media/i2c/saa7115.c:1366:3-9: opportunity for str_enable_disable(enable)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/i2c/max9286.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c
index 9fc4e130a273..d0f542343344 100644
--- a/drivers/media/i2c/max9286.c
+++ b/drivers/media/i2c/max9286.c
@@ -1330,7 +1330,7 @@ static int max9286_poc_enable(struct max9286_priv *priv, bool enable)
if (ret < 0)
dev_err(&priv->client->dev, "Unable to turn power %s\n",
- enable ? "on" : "off");
+ str_on_off(enable));
return ret;
}
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warning is fixed:
drivers/media/i2c/saa717x.c:1091:3-9: opportunity for str_enable_disable(enable)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/i2c/saa717x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/i2c/saa717x.c b/drivers/media/i2c/saa717x.c
index b0793bb0c02a..2337cef45e3a 100644
--- a/drivers/media/i2c/saa717x.c
+++ b/drivers/media/i2c/saa717x.c
@@ -1088,7 +1088,7 @@ static int saa717x_s_stream(struct v4l2_subdev *sd, int enable)
struct saa717x_state *decoder = to_state(sd);
v4l2_dbg(1, debug, sd, "decoder %s output\n",
- enable ? "enable" : "disable");
+ str_enable_disable(enable));
decoder->enable = enable;
saa717x_write(sd, 0x193, enable ? 0xa6 : 0x26);
return 0;
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/media/i2c/saa7127.c:678:33-49: opportunity for str_enabled_disabled(state -> cc_enable)
drivers/media/i2c/saa7127.c:677:33-50: opportunity for str_enabled_disabled(state -> vps_enable)
drivers/media/i2c/saa7127.c:379:19-25: opportunity for str_on_off(enable)
drivers/media/i2c/saa7127.c:346:49-55: opportunity for str_on_off(enable)
drivers/media/i2c/saa7127.c:430:42-48: opportunity for str_on_off(enable)
drivers/media/i2c/saa7127.c:405:42-48: opportunity for str_on_off(enable)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/i2c/saa7127.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/media/i2c/saa7127.c b/drivers/media/i2c/saa7127.c
index 818ed19cf37b..1ea5e4b9019d 100644
--- a/drivers/media/i2c/saa7127.c
+++ b/drivers/media/i2c/saa7127.c
@@ -343,7 +343,8 @@ static int saa7127_set_vps(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_
if (enable && (data->field != 0 || data->line != 16))
return -EINVAL;
if (state->vps_enable != enable) {
- v4l2_dbg(1, debug, sd, "Turn VPS Signal %s\n", enable ? "on" : "off");
+ v4l2_dbg(1, debug, sd, "Turn VPS Signal %s\n",
+ str_on_off(enable));
saa7127_write(sd, 0x54, enable << 7);
state->vps_enable = enable;
}
@@ -376,7 +377,7 @@ static int saa7127_set_cc(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_d
return -EINVAL;
if (state->cc_enable != enable) {
v4l2_dbg(1, debug, sd,
- "Turn CC %s\n", enable ? "on" : "off");
+ "Turn CC %s\n", str_on_off(enable));
saa7127_write(sd, SAA7127_REG_CLOSED_CAPTION,
(state->xds_enable << 7) | (enable << 6) | 0x11);
state->cc_enable = enable;
@@ -402,7 +403,7 @@ static int saa7127_set_xds(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_
if (enable && (data->field != 1 || data->line != 21))
return -EINVAL;
if (state->xds_enable != enable) {
- v4l2_dbg(1, debug, sd, "Turn XDS %s\n", enable ? "on" : "off");
+ v4l2_dbg(1, debug, sd, "Turn XDS %s\n", str_on_off(enable));
saa7127_write(sd, SAA7127_REG_CLOSED_CAPTION,
(enable << 7) | (state->cc_enable << 6) | 0x11);
state->xds_enable = enable;
@@ -427,7 +428,7 @@ static int saa7127_set_wss(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_
if (enable && (data->field != 0 || data->line != 23))
return -EINVAL;
if (state->wss_enable != enable) {
- v4l2_dbg(1, debug, sd, "Turn WSS %s\n", enable ? "on" : "off");
+ v4l2_dbg(1, debug, sd, "Turn WSS %s\n", str_on_off(enable));
saa7127_write(sd, 0x27, enable << 7);
state->wss_enable = enable;
}
@@ -674,8 +675,10 @@ static int saa7127_log_status(struct v4l2_subdev *sd)
output_strs[state->output_type] : "disabled");
v4l2_info(sd, "WSS: %s\n", state->wss_enable ?
wss_strs[state->wss_mode] : "disabled");
- v4l2_info(sd, "VPS: %s\n", state->vps_enable ? "enabled" : "disabled");
- v4l2_info(sd, "CC: %s\n", state->cc_enable ? "enabled" : "disabled");
+ v4l2_info(sd, "VPS: %s\n",
+ str_enabled_disabled(state->vps_enable));
+ v4l2_info(sd, "CC: %s\n",
+ str_enabled_disabled(state->cc_enable));
return 0;
}
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warning is fixed:
drivers/media/i2c/saa7115.c:1366:3-9: opportunity for str_enable_disable(enable)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/i2c/saa7115.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
index a1c71187e773..ff0931cf5ecf 100644
--- a/drivers/media/i2c/saa7115.c
+++ b/drivers/media/i2c/saa7115.c
@@ -1363,7 +1363,7 @@ static int saa711x_s_stream(struct v4l2_subdev *sd, int enable)
struct saa711x_state *state = to_state(sd);
v4l2_dbg(1, debug, sd, "%s output\n",
- enable ? "enable" : "disable");
+ str_enable_disable(enable));
if (state->enable == enable)
return 0;
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warning is fixed
drivers/media/i2c/saa7110.c:313:37-43: opportunity for str_on_off(enable)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/i2c/saa7110.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/i2c/saa7110.c b/drivers/media/i2c/saa7110.c
index 942aeeb40c52..15134ac706d7 100644
--- a/drivers/media/i2c/saa7110.c
+++ b/drivers/media/i2c/saa7110.c
@@ -310,7 +310,7 @@ static int saa7110_s_stream(struct v4l2_subdev *sd, int enable)
if (decoder->enable != enable) {
decoder->enable = enable;
saa7110_write(sd, 0x0E, enable ? 0x18 : 0x80);
- v4l2_dbg(1, debug, sd, "YUV %s\n", enable ? "on" : "off");
+ v4l2_dbg(1, debug, sd, "YUV %s\n", str_on_off(enable));
}
return 0;
}
--
2.46.1.824.gd892dcdcdd-goog
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 <ribalda@chromium.org>
---
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]);
--
2.46.1.824.gd892dcdcdd-goog
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 <ribalda@chromium.org>
---
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]);
--
2.46.1.824.gd892dcdcdd-goog
The following cocci warnings are fixed:
drivers/media/i2c/adv7511-v4l2.c:873:46-52: opportunity for str_enable_disable(enable)
drivers/media/i2c/adv7511-v4l2.c:620:28-51: opportunity for str_enabled_disabled(state -> cec_enabled_adap)
drivers/media/i2c/adv7511-v4l2.c:642:52-54: opportunity for str_on_off(on)
drivers/media/i2c/adv7511-v4l2.c:568:29-44: opportunity for str_on_off(state -> power_on)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/i2c/adv7511-v4l2.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/media/i2c/adv7511-v4l2.c b/drivers/media/i2c/adv7511-v4l2.c
index e9406d552699..d9af81015e72 100644
--- a/drivers/media/i2c/adv7511-v4l2.c
+++ b/drivers/media/i2c/adv7511-v4l2.c
@@ -565,7 +565,7 @@ static int adv7511_log_status(struct v4l2_subdev *sd)
"9", "A", "B", "C", "D", "E", "F"
};
- v4l2_info(sd, "power %s\n", state->power_on ? "on" : "off");
+ v4l2_info(sd, "power %s\n", str_on_off(state->power_on));
v4l2_info(sd, "%s hotplug, %s Rx Sense, %s EDID (%d block(s))\n",
(adv7511_rd(sd, 0x42) & MASK_ADV7511_HPD_DETECT) ? "detected" : "no",
(adv7511_rd(sd, 0x42) & MASK_ADV7511_MSEN_DETECT) ? "detected" : "no",
@@ -617,8 +617,8 @@ static int adv7511_log_status(struct v4l2_subdev *sd)
v4l2_info(sd, "i2c cec addr: 0x%x\n", state->i2c_cec_addr);
- 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) {
for (i = 0; i < ADV7511_MAX_ADDRS; i++) {
bool is_valid = state->cec_valid_addrs & (1 << i);
@@ -639,7 +639,7 @@ static int adv7511_s_power(struct v4l2_subdev *sd, int on)
const int retries = 20;
int i;
- v4l2_dbg(1, debug, sd, "%s: power %s\n", __func__, on ? "on" : "off");
+ v4l2_dbg(1, debug, sd, "%s: power %s\n", __func__, str_on_off(on));
state->power_on = on;
@@ -870,7 +870,8 @@ static void adv7511_set_isr(struct v4l2_subdev *sd, bool enable)
u8 irqs_rd;
int retries = 100;
- v4l2_dbg(2, debug, sd, "%s: %s\n", __func__, enable ? "enable" : "disable");
+ v4l2_dbg(2, debug, sd, "%s: %s\n", __func__,
+ str_enable_disable(enable));
if (state->enabled_irq == enable)
return;
--
2.46.1.824.gd892dcdcdd-goog
© 2016 - 2024 Red Hat, Inc.