]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/msm: Use str_enable_disable-like helpers
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Tue, 14 Jan 2025 19:17:24 +0000 (20:17 +0100)
committerDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Tue, 25 Feb 2025 18:07:44 +0000 (20:07 +0200)
Replace ternary (condition ? "enable" : "disable") syntax with helpers
from string_choices.h because:
1. Simple function call with one argument is easier to read.  Ternary
   operator has three arguments and with wrapping might lead to quite
   long code.
2. Is slightly shorter thus also easier to read.
3. It brings uniformity in the text - same string.
4. Allows deduping by the linker, which results in a smaller binary
   file.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/632406/
Link: https://lore.kernel.org/r/20250114191724.861601-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c
drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.c
drivers/gpu/drm/msm/dp/dp_ctrl.c
drivers/gpu/drm/msm/dp/dp_display.c
drivers/gpu/drm/msm/dp/dp_drm.c

index e9bbccc44dad8b391cd51daf902307105b2598fc..da9994a79ca293ec0265680c438835742102db2a 100644 (file)
@@ -5,6 +5,7 @@
 
 #define pr_fmt(fmt)    "[drm:%s:%d] " fmt, __func__, __LINE__
 #include <linux/delay.h>
+#include <linux/string_choices.h>
 #include "dpu_encoder_phys.h"
 #include "dpu_hw_interrupts.h"
 #include "dpu_hw_pingpong.h"
@@ -261,7 +262,7 @@ static int dpu_encoder_phys_cmd_control_vblank_irq(
 
        DRM_DEBUG_KMS("id:%u pp:%d enable=%s/%d\n", DRMID(phys_enc->parent),
                      phys_enc->hw_pp->idx - PINGPONG_0,
-                     enable ? "true" : "false", refcount);
+                     str_true_false(enable), refcount);
 
        if (enable) {
                if (phys_enc->vblank_refcount == 0)
@@ -285,7 +286,7 @@ end:
                DRM_ERROR("vblank irq err id:%u pp:%d ret:%d, enable %s/%d\n",
                          DRMID(phys_enc->parent),
                          phys_enc->hw_pp->idx - PINGPONG_0, ret,
-                         enable ? "true" : "false", refcount);
+                         str_true_false(enable), refcount);
        }
 
        return ret;
index 666de99a46a5b1fb2511eae4d2b069b6257a07bb..fc183fe37f56a756e0202204dbb8b1feed460240 100644 (file)
@@ -3,6 +3,7 @@
  * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
  */
 
+#include <linux/string_choices.h>
 #include "mdp5_kms.h"
 #include "mdp5_ctl.h"
 
@@ -233,7 +234,7 @@ int mdp5_ctl_set_encoder_state(struct mdp5_ctl *ctl,
                return -EINVAL;
 
        ctl->encoder_enabled = enabled;
-       DBG("intf_%d: %s", intf->num, enabled ? "on" : "off");
+       DBG("intf_%d: %s", intf->num, str_on_off(enabled));
 
        if (start_signal_needed(ctl, pipeline)) {
                send_start_signal(ctl);
index 9c463ae2f8fae916661fef1c7e225f55c1026478..d8633a596f8da88cc55f60de80bec8999ffb07c8 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/phy/phy.h>
 #include <linux/phy/phy-dp.h>
 #include <linux/pm_opp.h>
+#include <linux/string_choices.h>
 
 #include <drm/display/drm_dp_helper.h>
 #include <drm/drm_fixed.h>
@@ -1366,9 +1367,9 @@ int msm_dp_ctrl_core_clk_enable(struct msm_dp_ctrl *msm_dp_ctrl)
 
        drm_dbg_dp(ctrl->drm_dev, "enable core clocks \n");
        drm_dbg_dp(ctrl->drm_dev, "stream_clks:%s link_clks:%s core_clks:%s\n",
-                  ctrl->stream_clks_on ? "on" : "off",
-                  ctrl->link_clks_on ? "on" : "off",
-                  ctrl->core_clks_on ? "on" : "off");
+                  str_on_off(ctrl->stream_clks_on),
+                  str_on_off(ctrl->link_clks_on),
+                  str_on_off(ctrl->core_clks_on));
 
        return 0;
 }
@@ -1385,9 +1386,9 @@ void msm_dp_ctrl_core_clk_disable(struct msm_dp_ctrl *msm_dp_ctrl)
 
        drm_dbg_dp(ctrl->drm_dev, "disable core clocks \n");
        drm_dbg_dp(ctrl->drm_dev, "stream_clks:%s link_clks:%s core_clks:%s\n",
-                  ctrl->stream_clks_on ? "on" : "off",
-                  ctrl->link_clks_on ? "on" : "off",
-                  ctrl->core_clks_on ? "on" : "off");
+                  str_on_off(ctrl->stream_clks_on),
+                  str_on_off(ctrl->link_clks_on),
+                  str_on_off(ctrl->core_clks_on));
 }
 
 static int msm_dp_ctrl_link_clk_enable(struct msm_dp_ctrl *msm_dp_ctrl)
@@ -1416,9 +1417,9 @@ static int msm_dp_ctrl_link_clk_enable(struct msm_dp_ctrl *msm_dp_ctrl)
 
        drm_dbg_dp(ctrl->drm_dev, "enable link clocks\n");
        drm_dbg_dp(ctrl->drm_dev, "stream_clks:%s link_clks:%s core_clks:%s\n",
-                  ctrl->stream_clks_on ? "on" : "off",
-                  ctrl->link_clks_on ? "on" : "off",
-                  ctrl->core_clks_on ? "on" : "off");
+                  str_on_off(ctrl->stream_clks_on),
+                  str_on_off(ctrl->link_clks_on),
+                  str_on_off(ctrl->core_clks_on));
 
        return 0;
 }
@@ -1435,9 +1436,9 @@ static void msm_dp_ctrl_link_clk_disable(struct msm_dp_ctrl *msm_dp_ctrl)
 
        drm_dbg_dp(ctrl->drm_dev, "disabled link clocks\n");
        drm_dbg_dp(ctrl->drm_dev, "stream_clks:%s link_clks:%s core_clks:%s\n",
-                  ctrl->stream_clks_on ? "on" : "off",
-                  ctrl->link_clks_on ? "on" : "off",
-                  ctrl->core_clks_on ? "on" : "off");
+                  str_on_off(ctrl->stream_clks_on),
+                  str_on_off(ctrl->link_clks_on),
+                  str_on_off(ctrl->core_clks_on));
 }
 
 static int msm_dp_ctrl_enable_mainlink_clocks(struct msm_dp_ctrl_private *ctrl)
index 9aa8bbd73d869df7c8929faf8f5dbd1ecf901e2a..bbc47d86ae9e67245c87a8365df366cce0dc529e 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/of_irq.h>
 #include <linux/phy/phy.h>
 #include <linux/delay.h>
+#include <linux/string_choices.h>
 #include <drm/display/drm_dp_aux_bus.h>
 #include <drm/drm_edid.h>
 
@@ -343,8 +344,7 @@ static int msm_dp_display_send_hpd_notification(struct msm_dp_display_private *d
 {
        if ((hpd && dp->msm_dp_display.link_ready) ||
                        (!hpd && !dp->msm_dp_display.link_ready)) {
-               drm_dbg_dp(dp->drm_dev, "HPD already %s\n",
-                               (hpd ? "on" : "off"));
+               drm_dbg_dp(dp->drm_dev, "HPD already %s\n", str_on_off(hpd));
                return 0;
        }
 
index 022b3e815cf39e33edc8a54963722d045ac74535..cca57e56c906255a315e759e85a5af5982c80e9c 100644 (file)
@@ -3,6 +3,7 @@
  * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
  */
 
+#include <linux/string_choices.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_atomic.h>
 #include <drm/drm_bridge.h>
@@ -25,7 +26,7 @@ static enum drm_connector_status msm_dp_bridge_detect(struct drm_bridge *bridge)
        dp = to_dp_bridge(bridge)->msm_dp_display;
 
        drm_dbg_dp(dp->drm_dev, "link_ready = %s\n",
-               (dp->link_ready) ? "true" : "false");
+               str_true_false(dp->link_ready));
 
        return (dp->link_ready) ? connector_status_connected :
                                        connector_status_disconnected;
@@ -41,7 +42,7 @@ static int msm_dp_bridge_atomic_check(struct drm_bridge *bridge,
        dp = to_dp_bridge(bridge)->msm_dp_display;
 
        drm_dbg_dp(dp->drm_dev, "link_ready = %s\n",
-               (dp->link_ready) ? "true" : "false");
+               str_true_false(dp->link_ready));
 
        /*
         * There is no protection in the DRM framework to check if the display