[PATCH] drm/i915: use string choice helpers

From: Lalit Shankar Chowdhury

Date: Fri Sep 18 2026 - 00:24:07 EST


Prefer the str_high_low() and str_read_write() helper functions
over ternary operators with hardcoded strings.

No functional changes.

Signed-off-by: Lalit Shankar Chowdhury <lalitshankarch@xxxxxxxxx>
---
drivers/gpu/drm/i915/display/intel_cx0_phy.c | 5 +++--
drivers/gpu/drm/i915/gvt/aperture_gm.c | 4 +++-
drivers/gpu/drm/i915/vlv_iosf_sb.c | 6 ++++--
3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.c b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
index dbebd7210848..b83f0afaa9b5 100644
--- a/drivers/gpu/drm/i915/display/intel_cx0_phy.c
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.c
@@ -5,6 +5,7 @@

#include <linux/log2.h>
#include <linux/math64.h>
+#include <linux/string_choices.h>

#include <drm/drm_print.h>

@@ -189,7 +190,7 @@ int intel_cx0_wait_for_ack(struct intel_encoder *encoder,
drm_dbg_kms(display->drm,
"PHY %c Error occurred during %s command. Status: 0x%x\n",
phy_name(phy),
- command == XELPDP_PORT_P2M_COMMAND_READ_ACK ? "read" : "write", *val);
+ str_read_write(command == XELPDP_PORT_P2M_COMMAND_READ_ACK), *val);
intel_cx0_bus_reset(encoder, lane);
return -EINVAL;
}
@@ -198,7 +199,7 @@ int intel_cx0_wait_for_ack(struct intel_encoder *encoder,
drm_dbg_kms(display->drm,
"PHY %c Not a %s response. MSGBUS Status: 0x%x.\n",
phy_name(phy),
- command == XELPDP_PORT_P2M_COMMAND_READ_ACK ? "read" : "write", *val);
+ str_read_write(command == XELPDP_PORT_P2M_COMMAND_READ_ACK), *val);
intel_cx0_bus_reset(encoder, lane);
return -EINVAL;
}
diff --git a/drivers/gpu/drm/i915/gvt/aperture_gm.c b/drivers/gpu/drm/i915/gvt/aperture_gm.c
index 253b41789be9..794fb50e48dd 100644
--- a/drivers/gpu/drm/i915/gvt/aperture_gm.c
+++ b/drivers/gpu/drm/i915/gvt/aperture_gm.c
@@ -34,6 +34,8 @@
*
*/

+#include <linux/string_choices.h>
+
#include <drm/drm_print.h>

#include "gt/intel_ggtt_fencing.h"
@@ -76,7 +78,7 @@ static int alloc_gm(struct intel_vgpu *vgpu, bool high_gm)
mutex_unlock(&gt->ggtt->vm.mutex);
if (ret)
gvt_err("fail to alloc %s gm space from host\n",
- high_gm ? "high" : "low");
+ str_high_low(high_gm));

return ret;
}
diff --git a/drivers/gpu/drm/i915/vlv_iosf_sb.c b/drivers/gpu/drm/i915/vlv_iosf_sb.c
index 1f0332b4ad0d..fede1735bc08 100644
--- a/drivers/gpu/drm/i915/vlv_iosf_sb.c
+++ b/drivers/gpu/drm/i915/vlv_iosf_sb.c
@@ -3,6 +3,8 @@
* Copyright © 2013-2021 Intel Corporation
*/

+#include <linux/string_choices.h>
+
#include <drm/drm_print.h>
#include <drm/intel/display_parent_interface.h>

@@ -101,7 +103,7 @@ static int vlv_sideband_rw(struct drm_i915_private *i915,
VLV_IOSF_DOORBELL_REQ, IOSF_SB_BUSY, 0,
5)) {
drm_dbg(&i915->drm, "IOSF sideband idle wait (%s) timed out\n",
- is_read ? "read" : "write");
+ str_read_write(is_read));
return -EAGAIN;
}

@@ -125,7 +127,7 @@ static int vlv_sideband_rw(struct drm_i915_private *i915,
err = 0;
} else {
drm_dbg(&i915->drm, "IOSF sideband finish wait (%s) timed out\n",
- is_read ? "read" : "write");
+ str_read_write(is_read));
err = -ETIMEDOUT;
}

--
2.53.0