]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
staging: media: ipu3: use string_choices API instead of ternary operator
authorNai-Chen Cheng <bleach1827@gmail.com>
Sun, 3 Aug 2025 17:49:55 +0000 (01:49 +0800)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Mon, 25 Aug 2025 13:40:31 +0000 (15:40 +0200)
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>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/staging/media/ipu3/ipu3-css.c
drivers/staging/media/ipu3/ipu3-v4l2.c

index 1b0a59b789491e0eb8fe4296b1f3764ccba94635..777cac1c27bfac3757aa9e3c650d7d78c8163aae 100644 (file)
@@ -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) {
index ad6095bf717db6d3fc1cd19112884248a6b04fce..2f6041d342f4296446db294ae054c6085d3e8500 100644 (file)
@@ -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;
 }