From: Nai-Chen Cheng <bleach1827@gmail.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>,
Bingbu Cao <bingbu.cao@intel.com>,
Tianshu Qiu <tian.shu.qiu@intel.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-media@vger.kernel.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org,
linux-kernel-mentees@lists.linux.dev,
Shuah Khan <skhan@linuxfoundation.org>,
Nai-Chen Cheng <bleach1827@gmail.com>
Subject: [PATCH] staging: media: ipu3: use string_choices API instead of ternary operator
Date: Mon, 04 Aug 2025 01:49:55 +0800 [thread overview]
Message-ID: <20250804-ipu3-string-choices-v1-1-506834a013b5@gmail.com> (raw)
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>
reply other threads:[~2025-08-03 17:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250804-ipu3-string-choices-v1-1-506834a013b5@gmail.com \
--to=bleach1827@gmail.com \
--cc=bingbu.cao@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel-mentees@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=skhan@linuxfoundation.org \
--cc=tian.shu.qiu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).