Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/msm: Use str_enable_disable-like helpers

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>

authored by

Krzysztof Kozlowski and committed by
Dmitry Baryshkov
25dc6948 629ac9f0

+23 -19
+3 -2
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c
··· 5 5 6 6 #define pr_fmt(fmt) "[drm:%s:%d] " fmt, __func__, __LINE__ 7 7 #include <linux/delay.h> 8 + #include <linux/string_choices.h> 8 9 #include "dpu_encoder_phys.h" 9 10 #include "dpu_hw_interrupts.h" 10 11 #include "dpu_hw_pingpong.h" ··· 262 261 263 262 DRM_DEBUG_KMS("id:%u pp:%d enable=%s/%d\n", DRMID(phys_enc->parent), 264 263 phys_enc->hw_pp->idx - PINGPONG_0, 265 - enable ? "true" : "false", refcount); 264 + str_true_false(enable), refcount); 266 265 267 266 if (enable) { 268 267 if (phys_enc->vblank_refcount == 0) ··· 286 285 DRM_ERROR("vblank irq err id:%u pp:%d ret:%d, enable %s/%d\n", 287 286 DRMID(phys_enc->parent), 288 287 phys_enc->hw_pp->idx - PINGPONG_0, ret, 289 - enable ? "true" : "false", refcount); 288 + str_true_false(enable), refcount); 290 289 } 291 290 292 291 return ret;
+2 -1
drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.c
··· 3 3 * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved. 4 4 */ 5 5 6 + #include <linux/string_choices.h> 6 7 #include "mdp5_kms.h" 7 8 #include "mdp5_ctl.h" 8 9 ··· 234 233 return -EINVAL; 235 234 236 235 ctl->encoder_enabled = enabled; 237 - DBG("intf_%d: %s", intf->num, enabled ? "on" : "off"); 236 + DBG("intf_%d: %s", intf->num, str_on_off(enabled)); 238 237 239 238 if (start_signal_needed(ctl, pipeline)) { 240 239 send_start_signal(ctl);
+13 -12
drivers/gpu/drm/msm/dp/dp_ctrl.c
··· 11 11 #include <linux/phy/phy.h> 12 12 #include <linux/phy/phy-dp.h> 13 13 #include <linux/pm_opp.h> 14 + #include <linux/string_choices.h> 14 15 15 16 #include <drm/display/drm_dp_helper.h> 16 17 #include <drm/drm_fixed.h> ··· 1367 1366 1368 1367 drm_dbg_dp(ctrl->drm_dev, "enable core clocks \n"); 1369 1368 drm_dbg_dp(ctrl->drm_dev, "stream_clks:%s link_clks:%s core_clks:%s\n", 1370 - ctrl->stream_clks_on ? "on" : "off", 1371 - ctrl->link_clks_on ? "on" : "off", 1372 - ctrl->core_clks_on ? "on" : "off"); 1369 + str_on_off(ctrl->stream_clks_on), 1370 + str_on_off(ctrl->link_clks_on), 1371 + str_on_off(ctrl->core_clks_on)); 1373 1372 1374 1373 return 0; 1375 1374 } ··· 1386 1385 1387 1386 drm_dbg_dp(ctrl->drm_dev, "disable core clocks \n"); 1388 1387 drm_dbg_dp(ctrl->drm_dev, "stream_clks:%s link_clks:%s core_clks:%s\n", 1389 - ctrl->stream_clks_on ? "on" : "off", 1390 - ctrl->link_clks_on ? "on" : "off", 1391 - ctrl->core_clks_on ? "on" : "off"); 1388 + str_on_off(ctrl->stream_clks_on), 1389 + str_on_off(ctrl->link_clks_on), 1390 + str_on_off(ctrl->core_clks_on)); 1392 1391 } 1393 1392 1394 1393 static int msm_dp_ctrl_link_clk_enable(struct msm_dp_ctrl *msm_dp_ctrl) ··· 1417 1416 1418 1417 drm_dbg_dp(ctrl->drm_dev, "enable link clocks\n"); 1419 1418 drm_dbg_dp(ctrl->drm_dev, "stream_clks:%s link_clks:%s core_clks:%s\n", 1420 - ctrl->stream_clks_on ? "on" : "off", 1421 - ctrl->link_clks_on ? "on" : "off", 1422 - ctrl->core_clks_on ? "on" : "off"); 1419 + str_on_off(ctrl->stream_clks_on), 1420 + str_on_off(ctrl->link_clks_on), 1421 + str_on_off(ctrl->core_clks_on)); 1423 1422 1424 1423 return 0; 1425 1424 } ··· 1436 1435 1437 1436 drm_dbg_dp(ctrl->drm_dev, "disabled link clocks\n"); 1438 1437 drm_dbg_dp(ctrl->drm_dev, "stream_clks:%s link_clks:%s core_clks:%s\n", 1439 - ctrl->stream_clks_on ? "on" : "off", 1440 - ctrl->link_clks_on ? "on" : "off", 1441 - ctrl->core_clks_on ? "on" : "off"); 1438 + str_on_off(ctrl->stream_clks_on), 1439 + str_on_off(ctrl->link_clks_on), 1440 + str_on_off(ctrl->core_clks_on)); 1442 1441 } 1443 1442 1444 1443 static int msm_dp_ctrl_enable_mainlink_clocks(struct msm_dp_ctrl_private *ctrl)
+2 -2
drivers/gpu/drm/msm/dp/dp_display.c
··· 11 11 #include <linux/of_irq.h> 12 12 #include <linux/phy/phy.h> 13 13 #include <linux/delay.h> 14 + #include <linux/string_choices.h> 14 15 #include <drm/display/drm_dp_aux_bus.h> 15 16 #include <drm/drm_edid.h> 16 17 ··· 344 343 { 345 344 if ((hpd && dp->msm_dp_display.link_ready) || 346 345 (!hpd && !dp->msm_dp_display.link_ready)) { 347 - drm_dbg_dp(dp->drm_dev, "HPD already %s\n", 348 - (hpd ? "on" : "off")); 346 + drm_dbg_dp(dp->drm_dev, "HPD already %s\n", str_on_off(hpd)); 349 347 return 0; 350 348 } 351 349
+3 -2
drivers/gpu/drm/msm/dp/dp_drm.c
··· 3 3 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. 4 4 */ 5 5 6 + #include <linux/string_choices.h> 6 7 #include <drm/drm_atomic_helper.h> 7 8 #include <drm/drm_atomic.h> 8 9 #include <drm/drm_bridge.h> ··· 26 25 dp = to_dp_bridge(bridge)->msm_dp_display; 27 26 28 27 drm_dbg_dp(dp->drm_dev, "link_ready = %s\n", 29 - (dp->link_ready) ? "true" : "false"); 28 + str_true_false(dp->link_ready)); 30 29 31 30 return (dp->link_ready) ? connector_status_connected : 32 31 connector_status_disconnected; ··· 42 41 dp = to_dp_bridge(bridge)->msm_dp_display; 43 42 44 43 drm_dbg_dp(dp->drm_dev, "link_ready = %s\n", 45 - (dp->link_ready) ? "true" : "false"); 44 + str_true_false(dp->link_ready)); 46 45 47 46 /* 48 47 * There is no protection in the DRM framework to check if the display