* [PATCH 00/12] media: i2c: convert ternaries to string_choices helpers
@ 2026-05-27 14:40 Balakrishnan Sambath
2026-05-27 14:40 ` [PATCH 01/12] media: max9286: use string_choices helper Balakrishnan Sambath
` (12 more replies)
0 siblings, 13 replies; 15+ messages in thread
From: Balakrishnan Sambath @ 2026-05-27 14:40 UTC (permalink / raw)
To: Jacopo Mondi, Kieran Bingham, Laurent Pinchart,
Niklas Söderlund, Mauro Carvalho Chehab, Tim Harvey,
Hans Verkuil
Cc: linux-media, linux-kernel, Balakrishnan Sambath
Replace boolean-to-string ternaries with helpers from
<linux/string_choices.h> across drivers/media/i2c/.
Strings in uppercase or mixed case ("Yes"/"No", "ON"/"OFF", "On"/"Off")
in adv7604.c, isl7998x.c, and ths7303.c are left as-is since the
helpers return lowercase only.
Build-tested with x86_64 allmodconfig. No functional change.
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
Balakrishnan Sambath (12):
media: max9286: use string_choices helper
media: saa7110: use string_choices helper
media: tvp7002: use string_choices helper
media: vpx3220: use string_choices helper
media: msp3400: use string_choices helpers
media: tda1997x: use string_choices helper
media: ths8200: use string_choices helpers
media: adv7511: use string_choices helpers
media: saa7127: use string_choices helpers
media: adv7604: use string_choices helpers
media: tc358743: use string_choices helpers
media: adv7842: use string_choices helpers
drivers/media/i2c/adv7511-v4l2.c | 11 +++++-----
drivers/media/i2c/adv7604.c | 26 +++++++++++-----------
drivers/media/i2c/adv7842.c | 44 ++++++++++++++++++--------------------
drivers/media/i2c/max9286.c | 3 ++-
drivers/media/i2c/msp3400-driver.c | 5 +++--
drivers/media/i2c/saa7110.c | 3 ++-
drivers/media/i2c/saa7127.c | 13 +++++------
drivers/media/i2c/tc358743.c | 40 +++++++++++++++-------------------
drivers/media/i2c/tda1997x.c | 7 +++---
drivers/media/i2c/ths8200.c | 9 ++++----
drivers/media/i2c/tvp7002.c | 3 ++-
drivers/media/i2c/vpx3220.c | 3 ++-
12 files changed, 83 insertions(+), 84 deletions(-)
---
base-commit: a3d78e74dd3ed04797ea351edb7f0a19b961c063
change-id: 20260527-cleanup-string-choices-media-i2c-5abff65802ea
Best regards,
--
Balakrishnan Sambath <balakrishnan.s@microchip.com>
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 01/12] media: max9286: use string_choices helper
2026-05-27 14:40 [PATCH 00/12] media: i2c: convert ternaries to string_choices helpers Balakrishnan Sambath
@ 2026-05-27 14:40 ` Balakrishnan Sambath
2026-05-27 14:40 ` [PATCH 02/12] media: saa7110: " Balakrishnan Sambath
` (11 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Balakrishnan Sambath @ 2026-05-27 14:40 UTC (permalink / raw)
To: Jacopo Mondi, Kieran Bingham, Laurent Pinchart,
Niklas Söderlund, Mauro Carvalho Chehab, Tim Harvey,
Hans Verkuil
Cc: linux-media, linux-kernel, Balakrishnan Sambath
Replace open-coded boolean-to-string ternaries with the standard
helpers from <linux/string_choices.h>.
No functional change.
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
drivers/media/i2c/max9286.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c
index ac0712ce1..e2954ed26 100644
--- a/drivers/media/i2c/max9286.c
+++ b/drivers/media/i2c/max9286.c
@@ -22,6 +22,7 @@
#include <linux/of_graph.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
+#include <linux/string_choices.h>
#include <media/v4l2-async.h>
#include <media/v4l2-ctrls.h>
@@ -1330,7 +1331,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.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 02/12] media: saa7110: use string_choices helper
2026-05-27 14:40 [PATCH 00/12] media: i2c: convert ternaries to string_choices helpers Balakrishnan Sambath
2026-05-27 14:40 ` [PATCH 01/12] media: max9286: use string_choices helper Balakrishnan Sambath
@ 2026-05-27 14:40 ` Balakrishnan Sambath
2026-05-27 14:40 ` [PATCH 03/12] media: tvp7002: " Balakrishnan Sambath
` (10 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Balakrishnan Sambath @ 2026-05-27 14:40 UTC (permalink / raw)
To: Jacopo Mondi, Kieran Bingham, Laurent Pinchart,
Niklas Söderlund, Mauro Carvalho Chehab, Tim Harvey,
Hans Verkuil
Cc: linux-media, linux-kernel, Balakrishnan Sambath
Replace open-coded boolean-to-string ternaries with the standard
helpers from <linux/string_choices.h>.
No functional change.
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
drivers/media/i2c/saa7110.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/media/i2c/saa7110.c b/drivers/media/i2c/saa7110.c
index 652058b8f..d4b205db7 100644
--- a/drivers/media/i2c/saa7110.c
+++ b/drivers/media/i2c/saa7110.c
@@ -14,6 +14,7 @@
#include <linux/module.h>
#include <linux/init.h>
+#include <linux/string_choices.h>
#include <linux/types.h>
#include <linux/delay.h>
#include <linux/slab.h>
@@ -310,7 +311,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.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 03/12] media: tvp7002: use string_choices helper
2026-05-27 14:40 [PATCH 00/12] media: i2c: convert ternaries to string_choices helpers Balakrishnan Sambath
2026-05-27 14:40 ` [PATCH 01/12] media: max9286: use string_choices helper Balakrishnan Sambath
2026-05-27 14:40 ` [PATCH 02/12] media: saa7110: " Balakrishnan Sambath
@ 2026-05-27 14:40 ` Balakrishnan Sambath
2026-05-27 14:40 ` [PATCH 04/12] media: vpx3220: " Balakrishnan Sambath
` (9 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Balakrishnan Sambath @ 2026-05-27 14:40 UTC (permalink / raw)
To: Jacopo Mondi, Kieran Bingham, Laurent Pinchart,
Niklas Söderlund, Mauro Carvalho Chehab, Tim Harvey,
Hans Verkuil
Cc: linux-media, linux-kernel, Balakrishnan Sambath
Replace open-coded boolean-to-string ternaries with the standard
helpers from <linux/string_choices.h>.
No functional change.
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
drivers/media/i2c/tvp7002.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c
index 3979ccde5..fba668a60 100644
--- a/drivers/media/i2c/tvp7002.c
+++ b/drivers/media/i2c/tvp7002.c
@@ -14,6 +14,7 @@
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/slab.h>
+#include <linux/string_choices.h>
#include <linux/videodev2.h>
#include <linux/module.h>
#include <linux/of.h>
@@ -772,7 +773,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.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 04/12] media: vpx3220: use string_choices helper
2026-05-27 14:40 [PATCH 00/12] media: i2c: convert ternaries to string_choices helpers Balakrishnan Sambath
` (2 preceding siblings ...)
2026-05-27 14:40 ` [PATCH 03/12] media: tvp7002: " Balakrishnan Sambath
@ 2026-05-27 14:40 ` Balakrishnan Sambath
2026-05-27 14:40 ` [PATCH 05/12] media: msp3400: use string_choices helpers Balakrishnan Sambath
` (8 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Balakrishnan Sambath @ 2026-05-27 14:40 UTC (permalink / raw)
To: Jacopo Mondi, Kieran Bingham, Laurent Pinchart,
Niklas Söderlund, Mauro Carvalho Chehab, Tim Harvey,
Hans Verkuil
Cc: linux-media, linux-kernel, Balakrishnan Sambath
Replace open-coded boolean-to-string ternaries with the standard
helpers from <linux/string_choices.h>.
No functional change.
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
drivers/media/i2c/vpx3220.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/media/i2c/vpx3220.c b/drivers/media/i2c/vpx3220.c
index 29bcbb5a5..881129d67 100644
--- a/drivers/media/i2c/vpx3220.c
+++ b/drivers/media/i2c/vpx3220.c
@@ -8,6 +8,7 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h>
+#include <linux/string_choices.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
@@ -401,7 +402,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.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 05/12] media: msp3400: use string_choices helpers
2026-05-27 14:40 [PATCH 00/12] media: i2c: convert ternaries to string_choices helpers Balakrishnan Sambath
` (3 preceding siblings ...)
2026-05-27 14:40 ` [PATCH 04/12] media: vpx3220: " Balakrishnan Sambath
@ 2026-05-27 14:40 ` Balakrishnan Sambath
2026-05-27 14:40 ` [PATCH 06/12] media: tda1997x: use string_choices helper Balakrishnan Sambath
` (7 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Balakrishnan Sambath @ 2026-05-27 14:40 UTC (permalink / raw)
To: Jacopo Mondi, Kieran Bingham, Laurent Pinchart,
Niklas Söderlund, Mauro Carvalho Chehab, Tim Harvey,
Hans Verkuil
Cc: linux-media, linux-kernel, Balakrishnan Sambath
Replace open-coded boolean-to-string ternaries with the standard
helpers from <linux/string_choices.h>.
No functional change.
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
drivers/media/i2c/msp3400-driver.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/media/i2c/msp3400-driver.c b/drivers/media/i2c/msp3400-driver.c
index 413cfbc2d..88952e7e2 100644
--- a/drivers/media/i2c/msp3400-driver.c
+++ b/drivers/media/i2c/msp3400-driver.c
@@ -39,6 +39,7 @@
#include <linux/i2c.h>
#include <linux/kthread.h>
#include <linux/freezer.h>
+#include <linux/string_choices.h>
#include <linux/videodev2.h>
#include <media/v4l2-device.h>
#include <media/v4l2-ioctl.h>
@@ -338,8 +339,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.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 06/12] media: tda1997x: use string_choices helper
2026-05-27 14:40 [PATCH 00/12] media: i2c: convert ternaries to string_choices helpers Balakrishnan Sambath
` (4 preceding siblings ...)
2026-05-27 14:40 ` [PATCH 05/12] media: msp3400: use string_choices helpers Balakrishnan Sambath
@ 2026-05-27 14:40 ` Balakrishnan Sambath
2026-05-27 14:40 ` [PATCH 07/12] media: ths8200: use string_choices helpers Balakrishnan Sambath
` (6 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Balakrishnan Sambath @ 2026-05-27 14:40 UTC (permalink / raw)
To: Jacopo Mondi, Kieran Bingham, Laurent Pinchart,
Niklas Söderlund, Mauro Carvalho Chehab, Tim Harvey,
Hans Verkuil
Cc: linux-media, linux-kernel, Balakrishnan Sambath
Replace open-coded boolean-to-string ternaries with the standard
helpers from <linux/string_choices.h>.
No functional change.
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
drivers/media/i2c/tda1997x.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/media/i2c/tda1997x.c b/drivers/media/i2c/tda1997x.c
index afa1d6f34..d509d26ba 100644
--- a/drivers/media/i2c/tda1997x.c
+++ b/drivers/media/i2c/tda1997x.c
@@ -12,6 +12,7 @@
#include <linux/of_graph.h>
#include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
+#include <linux/string_choices.h>
#include <linux/types.h>
#include <linux/v4l2-dv-timings.h>
#include <linux/videodev2.h>
@@ -1969,13 +1970,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.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 07/12] media: ths8200: use string_choices helpers
2026-05-27 14:40 [PATCH 00/12] media: i2c: convert ternaries to string_choices helpers Balakrishnan Sambath
` (5 preceding siblings ...)
2026-05-27 14:40 ` [PATCH 06/12] media: tda1997x: use string_choices helper Balakrishnan Sambath
@ 2026-05-27 14:40 ` Balakrishnan Sambath
2026-05-27 14:40 ` [PATCH 08/12] media: adv7511: " Balakrishnan Sambath
` (5 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Balakrishnan Sambath @ 2026-05-27 14:40 UTC (permalink / raw)
To: Jacopo Mondi, Kieran Bingham, Laurent Pinchart,
Niklas Söderlund, Mauro Carvalho Chehab, Tim Harvey,
Hans Verkuil
Cc: linux-media, linux-kernel, Balakrishnan Sambath
Replace open-coded boolean-to-string ternaries with the standard
helpers from <linux/string_choices.h>.
No functional change.
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
drivers/media/i2c/ths8200.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/media/i2c/ths8200.c b/drivers/media/i2c/ths8200.c
index 808ef16ec..88d826a03 100644
--- a/drivers/media/i2c/ths8200.c
+++ b/drivers/media/i2c/ths8200.c
@@ -20,6 +20,7 @@
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/of.h>
+#include <linux/string_choices.h>
#include <linux/v4l2-dv-timings.h>
#include <media/v4l2-dv-timings.h>
@@ -127,10 +128,10 @@ static int ths8200_log_status(struct v4l2_subdev *sd)
v4l2_info(sd, "----- Chip status -----\n");
v4l2_info(sd, "version: %u\n", state->chip_version);
- 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, "power: %s\n", str_off_on(reg_03 & 0x0c));
+ v4l2_info(sd, "reset: %s\n", str_off_on(reg_03 & 0x01));
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 +147,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.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 08/12] media: adv7511: use string_choices helpers
2026-05-27 14:40 [PATCH 00/12] media: i2c: convert ternaries to string_choices helpers Balakrishnan Sambath
` (6 preceding siblings ...)
2026-05-27 14:40 ` [PATCH 07/12] media: ths8200: use string_choices helpers Balakrishnan Sambath
@ 2026-05-27 14:40 ` Balakrishnan Sambath
2026-05-27 14:40 ` [PATCH 09/12] media: saa7127: " Balakrishnan Sambath
` (4 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Balakrishnan Sambath @ 2026-05-27 14:40 UTC (permalink / raw)
To: Jacopo Mondi, Kieran Bingham, Laurent Pinchart,
Niklas Söderlund, Mauro Carvalho Chehab, Tim Harvey,
Hans Verkuil
Cc: linux-media, linux-kernel, Balakrishnan Sambath
Replace open-coded boolean-to-string ternaries with the standard
helpers from <linux/string_choices.h>.
No functional change.
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
drivers/media/i2c/adv7511-v4l2.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/media/i2c/adv7511-v4l2.c b/drivers/media/i2c/adv7511-v4l2.c
index 860cff50c..062ef8844 100644
--- a/drivers/media/i2c/adv7511-v4l2.c
+++ b/drivers/media/i2c/adv7511-v4l2.c
@@ -16,6 +16,7 @@
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/delay.h>
+#include <linux/string_choices.h>
#include <linux/videodev2.h>
#include <linux/workqueue.h>
#include <linux/hdmi.h>
@@ -583,7 +584,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",
@@ -592,8 +593,7 @@ static int adv7511_log_status(struct v4l2_subdev *sd)
v4l2_info(sd, "%s output %s\n",
(adv7511_rd(sd, 0xaf) & 0x02) ?
"HDMI" : "DVI-D",
- (adv7511_rd(sd, 0xa1) & 0x3c) ?
- "disabled" : "enabled");
+ str_disabled_enabled(adv7511_rd(sd, 0xa1) & 0x3c));
v4l2_info(sd, "state: %s, error: %s, detect count: %u, msk/irq: %02x/%02x\n",
states[adv7511_rd(sd, 0xc8) & 0xf],
errors[adv7511_rd(sd, 0xc8) >> 4], state->edid_detect_counter,
@@ -635,8 +635,7 @@ 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);
@@ -657,7 +656,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;
--
2.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 09/12] media: saa7127: use string_choices helpers
2026-05-27 14:40 [PATCH 00/12] media: i2c: convert ternaries to string_choices helpers Balakrishnan Sambath
` (7 preceding siblings ...)
2026-05-27 14:40 ` [PATCH 08/12] media: adv7511: " Balakrishnan Sambath
@ 2026-05-27 14:40 ` Balakrishnan Sambath
2026-05-27 14:40 ` [PATCH 10/12] media: adv7604: " Balakrishnan Sambath
` (3 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Balakrishnan Sambath @ 2026-05-27 14:40 UTC (permalink / raw)
To: Jacopo Mondi, Kieran Bingham, Laurent Pinchart,
Niklas Söderlund, Mauro Carvalho Chehab, Tim Harvey,
Hans Verkuil
Cc: linux-media, linux-kernel, Balakrishnan Sambath
Replace open-coded boolean-to-string ternaries with the standard
helpers from <linux/string_choices.h>.
No functional change.
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
drivers/media/i2c/saa7127.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/media/i2c/saa7127.c b/drivers/media/i2c/saa7127.c
index fdf17f6fa..182b40855 100644
--- a/drivers/media/i2c/saa7127.c
+++ b/drivers/media/i2c/saa7127.c
@@ -39,6 +39,7 @@
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/i2c.h>
+#include <linux/string_choices.h>
#include <linux/videodev2.h>
#include <media/v4l2-device.h>
#include <media/i2c/saa7127.h>
@@ -343,7 +344,7 @@ 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,8 @@ 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.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 10/12] media: adv7604: use string_choices helpers
2026-05-27 14:40 [PATCH 00/12] media: i2c: convert ternaries to string_choices helpers Balakrishnan Sambath
` (8 preceding siblings ...)
2026-05-27 14:40 ` [PATCH 09/12] media: saa7127: " Balakrishnan Sambath
@ 2026-05-27 14:40 ` Balakrishnan Sambath
2026-05-27 14:41 ` [PATCH 11/12] media: tc358743: " Balakrishnan Sambath
` (2 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Balakrishnan Sambath @ 2026-05-27 14:40 UTC (permalink / raw)
To: Jacopo Mondi, Kieran Bingham, Laurent Pinchart,
Niklas Söderlund, Mauro Carvalho Chehab, Tim Harvey,
Hans Verkuil
Cc: linux-media, linux-kernel, Balakrishnan Sambath
Replace open-coded boolean-to-string ternaries with the standard
helpers from <linux/string_choices.h>.
No functional change.
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
drivers/media/i2c/adv7604.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index ac9c69ce4..3b06ddad8 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -23,6 +23,7 @@
#include <linux/module.h>
#include <linux/of_graph.h>
#include <linux/slab.h>
+#include <linux/string_choices.h>
#include <linux/v4l2-dv-timings.h>
#include <linux/videodev2.h>
#include <linux/workqueue.h>
@@ -2563,15 +2564,14 @@ static int adv76xx_log_status(struct v4l2_subdev *sd)
};
v4l2_info(sd, "-----Chip status-----\n");
- v4l2_info(sd, "Chip power: %s\n", no_power(sd) ? "off" : "on");
+ v4l2_info(sd, "Chip power: %s\n", str_off_on(no_power(sd)));
edid_enabled = rep_read(sd, info->edid_status_reg);
v4l2_info(sd, "EDID enabled port A: %s, B: %s, C: %s, D: %s\n",
((edid_enabled & 0x01) ? "Yes" : "No"),
((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;
@@ -2592,14 +2592,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);
@@ -2639,7 +2639,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]);
@@ -2651,9 +2651,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;
@@ -2674,7 +2674,7 @@ 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.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 11/12] media: tc358743: use string_choices helpers
2026-05-27 14:40 [PATCH 00/12] media: i2c: convert ternaries to string_choices helpers Balakrishnan Sambath
` (9 preceding siblings ...)
2026-05-27 14:40 ` [PATCH 10/12] media: adv7604: " Balakrishnan Sambath
@ 2026-05-27 14:41 ` Balakrishnan Sambath
2026-05-27 14:41 ` [PATCH 12/12] media: adv7842: " Balakrishnan Sambath
2026-05-27 20:54 ` [PATCH 00/12] media: i2c: convert ternaries to " Laurent Pinchart
12 siblings, 0 replies; 15+ messages in thread
From: Balakrishnan Sambath @ 2026-05-27 14:41 UTC (permalink / raw)
To: Jacopo Mondi, Kieran Bingham, Laurent Pinchart,
Niklas Söderlund, Mauro Carvalho Chehab, Tim Harvey,
Hans Verkuil
Cc: linux-media, linux-kernel, Balakrishnan Sambath
Replace open-coded boolean-to-string ternaries with the standard
helpers from <linux/string_choices.h>.
No functional change.
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
drivers/media/i2c/tc358743.c | 40 +++++++++++++++++-----------------------
1 file changed, 17 insertions(+), 23 deletions(-)
diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
index fbd38bbfe..57d2808ba 100644
--- a/drivers/media/i2c/tc358743.c
+++ b/drivers/media/i2c/tc358743.c
@@ -20,6 +20,7 @@
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/interrupt.h>
+#include <linux/string_choices.h>
#include <linux/timer.h>
#include <linux/of_graph.h>
#include <linux/videodev2.h>
@@ -1308,7 +1309,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);
@@ -1385,26 +1386,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");
@@ -1421,17 +1420,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" :
@@ -1440,14 +1435,13 @@ 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.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 12/12] media: adv7842: use string_choices helpers
2026-05-27 14:40 [PATCH 00/12] media: i2c: convert ternaries to string_choices helpers Balakrishnan Sambath
` (10 preceding siblings ...)
2026-05-27 14:41 ` [PATCH 11/12] media: tc358743: " Balakrishnan Sambath
@ 2026-05-27 14:41 ` Balakrishnan Sambath
2026-05-27 20:54 ` [PATCH 00/12] media: i2c: convert ternaries to " Laurent Pinchart
12 siblings, 0 replies; 15+ messages in thread
From: Balakrishnan Sambath @ 2026-05-27 14:41 UTC (permalink / raw)
To: Jacopo Mondi, Kieran Bingham, Laurent Pinchart,
Niklas Söderlund, Mauro Carvalho Chehab, Tim Harvey,
Hans Verkuil
Cc: linux-media, linux-kernel, Balakrishnan Sambath
Replace open-coded boolean-to-string ternaries with the standard
helpers from <linux/string_choices.h>.
No functional change.
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
drivers/media/i2c/adv7842.c | 44 +++++++++++++++++++++-----------------------
1 file changed, 21 insertions(+), 23 deletions(-)
diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index 3cfae89ce..3b68a6ad6 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -22,6 +22,7 @@
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/delay.h>
+#include <linux/string_choices.h>
#include <linux/videodev2.h>
#include <linux/workqueue.h>
#include <linux/v4l2-dv-timings.h>
@@ -2657,12 +2658,12 @@ static int adv7842_sdp_log_status(struct v4l2_subdev *sd)
/* SDP (Standard definition processor) block */
u8 sdp_signal_detected = sdp_read(sd, 0x5A) & 0x01;
- v4l2_info(sd, "Chip powered %s\n", no_power(sd) ? "off" : "on");
+ v4l2_info(sd, "Chip powered %s\n", str_off_on(no_power(sd)));
v4l2_info(sd, "Prim-mode = 0x%x, video std = 0x%x\n",
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) {
@@ -2687,7 +2688,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");
}
@@ -2735,19 +2736,16 @@ static int adv7842_cp_log_status(struct v4l2_subdev *sd)
};
v4l2_info(sd, "-----Chip status-----\n");
- v4l2_info(sd, "Chip power: %s\n", no_power(sd) ? "off" : "on");
+ v4l2_info(sd, "Chip power: %s\n", str_off_on(no_power(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;
@@ -2763,21 +2761,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);
@@ -2821,7 +2819,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));
temp = cp_read(sd, 0xf4) >> 4;
v4l2_info(sd, "Color space conversion: %s\n",
temp < 0 ? "" : csc_coeff_sel_rb[temp]);
@@ -2831,9 +2829,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;
@@ -2853,7 +2851,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));
temp = hdmi_read(sd, 0x0b) >> 6;
v4l2_info(sd, "Deep color mode: %s\n",
temp < 0 ? "" : deep_color_mode_txt[temp]);
--
2.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 00/12] media: i2c: convert ternaries to string_choices helpers
2026-05-27 14:40 [PATCH 00/12] media: i2c: convert ternaries to string_choices helpers Balakrishnan Sambath
` (11 preceding siblings ...)
2026-05-27 14:41 ` [PATCH 12/12] media: adv7842: " Balakrishnan Sambath
@ 2026-05-27 20:54 ` Laurent Pinchart
2026-06-04 6:07 ` Balakrishnan.S
12 siblings, 1 reply; 15+ messages in thread
From: Laurent Pinchart @ 2026-05-27 20:54 UTC (permalink / raw)
To: Balakrishnan Sambath
Cc: Jacopo Mondi, Kieran Bingham, Niklas Söderlund,
Mauro Carvalho Chehab, Tim Harvey, Hans Verkuil, linux-media,
linux-kernel
On Wed, May 27, 2026 at 08:10:49PM +0530, Balakrishnan Sambath wrote:
> Replace boolean-to-string ternaries with helpers from
> <linux/string_choices.h> across drivers/media/i2c/.
I don't think this is an improvement.
> Strings in uppercase or mixed case ("Yes"/"No", "ON"/"OFF", "On"/"Off")
> in adv7604.c, isl7998x.c, and ths7303.c are left as-is since the
> helpers return lowercase only.
>
> Build-tested with x86_64 allmodconfig. No functional change.
>
> Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
> ---
> Balakrishnan Sambath (12):
> media: max9286: use string_choices helper
> media: saa7110: use string_choices helper
> media: tvp7002: use string_choices helper
> media: vpx3220: use string_choices helper
> media: msp3400: use string_choices helpers
> media: tda1997x: use string_choices helper
> media: ths8200: use string_choices helpers
> media: adv7511: use string_choices helpers
> media: saa7127: use string_choices helpers
> media: adv7604: use string_choices helpers
> media: tc358743: use string_choices helpers
> media: adv7842: use string_choices helpers
>
> drivers/media/i2c/adv7511-v4l2.c | 11 +++++-----
> drivers/media/i2c/adv7604.c | 26 +++++++++++-----------
> drivers/media/i2c/adv7842.c | 44 ++++++++++++++++++--------------------
> drivers/media/i2c/max9286.c | 3 ++-
> drivers/media/i2c/msp3400-driver.c | 5 +++--
> drivers/media/i2c/saa7110.c | 3 ++-
> drivers/media/i2c/saa7127.c | 13 +++++------
> drivers/media/i2c/tc358743.c | 40 +++++++++++++++-------------------
> drivers/media/i2c/tda1997x.c | 7 +++---
> drivers/media/i2c/ths8200.c | 9 ++++----
> drivers/media/i2c/tvp7002.c | 3 ++-
> drivers/media/i2c/vpx3220.c | 3 ++-
> 12 files changed, 83 insertions(+), 84 deletions(-)
> ---
> base-commit: a3d78e74dd3ed04797ea351edb7f0a19b961c063
> change-id: 20260527-cleanup-string-choices-media-i2c-5abff65802ea
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 00/12] media: i2c: convert ternaries to string_choices helpers
2026-05-27 20:54 ` [PATCH 00/12] media: i2c: convert ternaries to " Laurent Pinchart
@ 2026-06-04 6:07 ` Balakrishnan.S
0 siblings, 0 replies; 15+ messages in thread
From: Balakrishnan.S @ 2026-06-04 6:07 UTC (permalink / raw)
To: laurent.pinchart
Cc: jacopo+renesas, kieran.bingham+renesas, niklas.soderlund+renesas,
mchehab, tharvey, hverkuil, linux-media, linux-kernel
Hi Laurent,
On 28/05/26 2:24 am, Laurent Pinchart wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> On Wed, May 27, 2026 at 08:10:49PM +0530, Balakrishnan Sambath wrote:
>> Replace boolean-to-string ternaries with helpers from
>> <linux/string_choices.h> across drivers/media/i2c/.
>
> I don't think this is an improvement.
Thanks for looking. I had noticed these through the coccinelle
string_choices check and just sent it as a cleanup, referring to few
similar works done on other subsystems( Just thought it sync's naturally
and offers better readability).
ACPI: proc: Use str_enabled_disabled() helper
https://patch.msgid.link/20250612201321.3536493-5-andriy.shevchenko@linux.intel.com
alloc_tag: use str_on_off() helper
https://lkml.kernel.org/r/20250814093827.237980-1-visitorckw@gmail.com
But I take your point, if you'd rather leave them as is I'm happy
to drop it.
Thanks,
Balakrishnan S
>
>> Strings in uppercase or mixed case ("Yes"/"No", "ON"/"OFF", "On"/"Off")
>> in adv7604.c, isl7998x.c, and ths7303.c are left as-is since the
>> helpers return lowercase only.
>>
>> Build-tested with x86_64 allmodconfig. No functional change.
>>
>> Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
>> ---
>> Balakrishnan Sambath (12):
>> media: max9286: use string_choices helper
>> media: saa7110: use string_choices helper
>> media: tvp7002: use string_choices helper
>> media: vpx3220: use string_choices helper
>> media: msp3400: use string_choices helpers
>> media: tda1997x: use string_choices helper
>> media: ths8200: use string_choices helpers
>> media: adv7511: use string_choices helpers
>> media: saa7127: use string_choices helpers
>> media: adv7604: use string_choices helpers
>> media: tc358743: use string_choices helpers
>> media: adv7842: use string_choices helpers
>>
>> drivers/media/i2c/adv7511-v4l2.c | 11 +++++-----
>> drivers/media/i2c/adv7604.c | 26 +++++++++++-----------
>> drivers/media/i2c/adv7842.c | 44 ++++++++++++++++++--------------------
>> drivers/media/i2c/max9286.c | 3 ++-
>> drivers/media/i2c/msp3400-driver.c | 5 +++--
>> drivers/media/i2c/saa7110.c | 3 ++-
>> drivers/media/i2c/saa7127.c | 13 +++++------
>> drivers/media/i2c/tc358743.c | 40 +++++++++++++++-------------------
>> drivers/media/i2c/tda1997x.c | 7 +++---
>> drivers/media/i2c/ths8200.c | 9 ++++----
>> drivers/media/i2c/tvp7002.c | 3 ++-
>> drivers/media/i2c/vpx3220.c | 3 ++-
>> 12 files changed, 83 insertions(+), 84 deletions(-)
>> ---
>> base-commit: a3d78e74dd3ed04797ea351edb7f0a19b961c063
>> change-id: 20260527-cleanup-string-choices-media-i2c-5abff65802ea
>
> --
> Regards,
>
> Laurent Pinchart
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2026-06-04 6:07 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-27 14:40 [PATCH 00/12] media: i2c: convert ternaries to string_choices helpers Balakrishnan Sambath
2026-05-27 14:40 ` [PATCH 01/12] media: max9286: use string_choices helper Balakrishnan Sambath
2026-05-27 14:40 ` [PATCH 02/12] media: saa7110: " Balakrishnan Sambath
2026-05-27 14:40 ` [PATCH 03/12] media: tvp7002: " Balakrishnan Sambath
2026-05-27 14:40 ` [PATCH 04/12] media: vpx3220: " Balakrishnan Sambath
2026-05-27 14:40 ` [PATCH 05/12] media: msp3400: use string_choices helpers Balakrishnan Sambath
2026-05-27 14:40 ` [PATCH 06/12] media: tda1997x: use string_choices helper Balakrishnan Sambath
2026-05-27 14:40 ` [PATCH 07/12] media: ths8200: use string_choices helpers Balakrishnan Sambath
2026-05-27 14:40 ` [PATCH 08/12] media: adv7511: " Balakrishnan Sambath
2026-05-27 14:40 ` [PATCH 09/12] media: saa7127: " Balakrishnan Sambath
2026-05-27 14:40 ` [PATCH 10/12] media: adv7604: " Balakrishnan Sambath
2026-05-27 14:41 ` [PATCH 11/12] media: tc358743: " Balakrishnan Sambath
2026-05-27 14:41 ` [PATCH 12/12] media: adv7842: " Balakrishnan Sambath
2026-05-27 20:54 ` [PATCH 00/12] media: i2c: convert ternaries to " Laurent Pinchart
2026-06-04 6:07 ` Balakrishnan.S
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox