Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Cc: jani.nikula@intel.com
Subject: [PATCH 01/11] drm/i915/lspcon: use u8 variable to hold 1-byte DPCD reads
Date: Wed, 16 Sep 2026 11:29:32 +0300	[thread overview]
Message-ID: <66a74267a3da7619dda8dc2b1bb1bfcedc25df0d.1789547331.git.jani.nikula@intel.com> (raw)
In-Reply-To: <cover.1789547331.git.jani.nikula@intel.com>

Passing a pointer to a u32 variable for a 1-byte reads is error prone,
and only works because it's always initialized to 0 before the read, and
the code's running on little-endian CPUs. Switch to u8 variables.

In _lspcon_write_avi_infoframe_mca(), add a separate variable to hold
the number of bytes written instead of reusing the same variable for two
purposes.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/display/intel_lspcon.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.c b/drivers/gpu/drm/i915/display/intel_lspcon.c
index 9ceabbc981a1..b306bf5f6130 100644
--- a/drivers/gpu/drm/i915/display/intel_lspcon.c
+++ b/drivers/gpu/drm/i915/display/intel_lspcon.c
@@ -435,14 +435,14 @@ static bool _lspcon_write_avi_infoframe_parade(struct drm_dp_aux *aux,
 static bool _lspcon_write_avi_infoframe_mca(struct drm_dp_aux *aux,
 					    const u8 *buffer, ssize_t len)
 {
-	int ret;
-	u32 val = 0;
+	int ret, written = 0;
 	u32 retry;
 	u16 reg;
 	const u8 *data = buffer;
+	u8 val;
 
 	reg = LSPCON_MCA_AVI_IF_WRITE_OFFSET;
-	while (val < len) {
+	while (written < len) {
 		/* DPCD write for AVI IF can fail on a slow FW day, so retry */
 		for (retry = 0; retry < 5; retry++) {
 			ret = drm_dp_dpcd_write(aux, reg, (void *)data, 1);
@@ -456,7 +456,9 @@ static bool _lspcon_write_avi_infoframe_mca(struct drm_dp_aux *aux,
 				return false;
 			}
 		}
-		val++; reg++; data++;
+		written++;
+		reg++;
+		data++;
 	}
 
 	val = 0;
@@ -612,8 +614,8 @@ void lspcon_set_infoframes(struct intel_encoder *encoder,
 static bool _lspcon_read_avi_infoframe_enabled_mca(struct drm_dp_aux *aux)
 {
 	int ret;
-	u32 val = 0;
 	u16 reg = LSPCON_MCA_AVI_IF_CTRL;
+	u8 val;
 
 	ret = drm_dp_dpcd_read(aux, reg, &val, 1);
 	if (ret < 0) {
@@ -627,8 +629,8 @@ static bool _lspcon_read_avi_infoframe_enabled_mca(struct drm_dp_aux *aux)
 static bool _lspcon_read_avi_infoframe_enabled_parade(struct drm_dp_aux *aux)
 {
 	int ret;
-	u32 val = 0;
 	u16 reg = LSPCON_PARADE_AVI_IF_CTRL;
+	u8 val;
 
 	ret = drm_dp_dpcd_read(aux, reg, &val, 1);
 	if (ret < 0) {
-- 
2.47.3


  reply	other threads:[~2026-09-16  8:29 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16  8:29 [PATCH 00/11] drm/i915/display: switch to modern drm_dp_dpcd* accessors Jani Nikula
2026-09-16  8:29 ` Jani Nikula [this message]
2026-09-16  9:14   ` [PATCH 01/11] drm/i915/lspcon: use u8 variable to hold 1-byte DPCD reads Kandpal, Suraj
2026-09-16  8:29 ` [PATCH 02/11] drm/i915/lspcon: switch to drm_dp_dpcd_{read_byte, write_byte, write_data} Jani Nikula
2026-09-16  9:16   ` Kandpal, Suraj
2026-09-17 12:03     ` Jani Nikula
2026-09-18  3:02       ` Kandpal, Suraj
2026-09-16  8:29 ` [PATCH 03/11] drm/i915/alpm: switch to drm_dp_dpcd_{read_byte, write_byte} Jani Nikula
2026-09-16  9:17   ` Kandpal, Suraj
2026-09-18  3:04     ` Kandpal, Suraj
2026-09-16  8:29 ` [PATCH 04/11] drm/i915/ddi: switch to drm_dp_dpcd_write_byte() Jani Nikula
2026-09-18  3:05   ` Kandpal, Suraj
2026-09-16  8:29 ` [PATCH 05/11] drm/i915/lspcon: switch to drm_dp_dpcd_{read_byte, read_data, write_byte, write_data}() Jani Nikula
2026-09-18  3:08   ` Kandpal, Suraj
2026-09-16  8:29 ` [PATCH 06/11] drm/i915/dp: switch to drm_dp_dpcd_{read_byte, read_data, write_byte, write_data} Jani Nikula
2026-09-18  3:09   ` Kandpal, Suraj
2026-09-16  8:29 ` [PATCH 07/11] drm/i915/hdcp: switch to drm_dp_dpcd_{read_byte, read_data, write_data}() Jani Nikula
2026-09-16  8:35   ` sashiko-bot
2026-09-18  3:36     ` Kandpal, Suraj
2026-09-21  9:41   ` [PATCH v2] " Jani Nikula
2026-09-22 12:03     ` [PATCH v2] drm/i915/hdcp: switch to drm_dp_dpcd_{read_byte,read_data,write_data}() Kandpal, Suraj
2026-09-22 13:43       ` Jani Nikula
2026-09-16  8:29 ` [PATCH 08/11] drm/i915/dp: switch link training to drm_dp_dpcd_{read_byte, read_data, write_byte, write_data}() Jani Nikula
2026-09-18  3:38   ` Kandpal, Suraj
2026-09-16  8:29 ` [PATCH 09/11] drm/i915/dp-mst: switch to drm_dp_dpcd_read_byte() Jani Nikula
2026-09-16  9:29   ` Kandpal, Suraj
2026-09-16  8:29 ` [PATCH 10/11] drm/i915/dp-test: switch to drm_dp_dpcd_{read_byte, read_data, write_byte, write_data}() Jani Nikula
2026-09-18  3:38   ` Kandpal, Suraj
2026-09-16  8:29 ` [PATCH 11/11] drm/i915/psr: " Jani Nikula
2026-09-16  9:30   ` Kandpal, Suraj
2026-09-16  8:37 ` ✗ CI.checkpatch: warning for drm/i915/display: switch to modern drm_dp_dpcd* accessors Patchwork
2026-09-16  8:39 ` ✓ CI.KUnit: success " Patchwork
2026-09-16  9:19 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-16 10:51 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-09-21 11:12 ` ✗ CI.checkpatch: warning for drm/i915/display: switch to modern drm_dp_dpcd* accessors (rev2) Patchwork
2026-09-21 11:14 ` ✓ CI.KUnit: success " Patchwork
2026-09-21 12:45 ` ✗ Xe.CI.BAT: failure " Patchwork
2026-09-21 16:23 ` ✗ Xe.CI.FULL: " Patchwork

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=66a74267a3da7619dda8dc2b1bb1bfcedc25df0d.1789547331.git.jani.nikula@intel.com \
    --to=jani.nikula@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    /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