linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: media: ipu3: use string_choices API instead of ternary operator
@ 2025-08-03 17:49 Nai-Chen Cheng
  0 siblings, 0 replies; only message in thread
From: Nai-Chen Cheng @ 2025-08-03 17:49 UTC (permalink / raw)
  To: Sakari Ailus, Bingbu Cao, Tianshu Qiu, Mauro Carvalho Chehab,
	Greg Kroah-Hartman
  Cc: linux-media, linux-staging, linux-kernel, linux-kernel-mentees,
	Shuah Khan, Nai-Chen Cheng

Use string_choices API instead of manually determining the output using
ternary operator to improve code readability and consistency.

This also fixes cocci warning.

Signed-off-by: Nai-Chen Cheng <bleach1827@gmail.com>
---
 drivers/staging/media/ipu3/ipu3-css.c  | 3 ++-
 drivers/staging/media/ipu3/ipu3-v4l2.c | 5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/media/ipu3/ipu3-css.c b/drivers/staging/media/ipu3/ipu3-css.c
index 1b0a59b78949..777cac1c27bf 100644
--- a/drivers/staging/media/ipu3/ipu3-css.c
+++ b/drivers/staging/media/ipu3/ipu3-css.c
@@ -4,6 +4,7 @@
 #include <linux/device.h>
 #include <linux/iopoll.h>
 #include <linux/slab.h>
+#include <linux/string_choices.h>
 
 #include "ipu3.h"
 #include "ipu3-css.h"
@@ -226,7 +227,7 @@ int imgu_css_set_powerup(struct device *dev, void __iomem *base,
 	state = readl(base + IMGU_REG_STATE);
 
 	dev_dbg(dev, "CSS pm_ctrl 0x%x state 0x%x (power %s)\n",
-		pm_ctrl, state, state & IMGU_STATE_POWER_DOWN ? "down" : "up");
+		pm_ctrl, state, str_down_up(state & IMGU_STATE_POWER_DOWN));
 
 	/* Power up CSS using wrapper */
 	if (state & IMGU_STATE_POWER_DOWN) {
diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c
index ad6095bf717d..2f6041d342f4 100644
--- a/drivers/staging/media/ipu3/ipu3-v4l2.c
+++ b/drivers/staging/media/ipu3/ipu3-v4l2.c
@@ -3,6 +3,7 @@
 
 #include <linux/module.h>
 #include <linux/pm_runtime.h>
+#include <linux/string_choices.h>
 
 #include <media/v4l2-event.h>
 #include <media/v4l2-ioctl.h>
@@ -287,7 +288,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 +303,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;
 }

---
base-commit: 186f3edfdd41f2ae87fc40a9ccba52a3bf930994
change-id: 20250804-ipu3-string-choices-2a6004f2d788

Best regards,
-- 
Nai-Chen Cheng <bleach1827@gmail.com>


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-08-03 17:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-03 17:49 [PATCH] staging: media: ipu3: use string_choices API instead of ternary operator Nai-Chen Cheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).