[PATCH 09/12] media: saa7127: use string_choices helpers

From: Balakrishnan Sambath

Date: Wed May 27 2026 - 10:48:12 EST


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@xxxxxxxxxxxxx>
---
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