From: Daniel Stone <daniel@fooishbar.org>
To: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Andrzej Hajda <andrzej.hajda@intel.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Robert Foss <rfoss@kernel.org>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Luca Ceresoli <luca.ceresoli@bootlin.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
kernel@collabora.com
Subject: Re: [PATCH v2 3/3] drm/scdc-helper: Implement parsing and printing HDMI 2.1 fields
Date: Fri, 22 May 2026 18:38:24 +0100 [thread overview]
Message-ID: <CAPj87rMe_oOR66uBE1PpNq4oMgpw_XhAbQit3tohTQbUD2dPdQ@mail.gmail.com> (raw)
In-Reply-To: <20260520-scdc-link-health-v2-3-511af18cd64b@collabora.com>
Hi Nicolas,
On Wed, 20 May 2026 at 14:36, Nicolas Frattaroli
<nicolas.frattaroli@collabora.com> wrote:
> - for (i = 0; i < ARRAY_SIZE(buf) - 1; i += 2) {
> + for (i = 0; i <= ERR_DET_OFF(SCDC_ERR_DET_2_H); i += 2) {
> if (buf[i + 1] & SCDC_CHANNEL_VALID)
> counter[i / 2] = buf[i] | (buf[i + 1] & ~SCDC_CHANNEL_VALID) << 8;
> else
> @@ -355,9 +433,15 @@ int drm_scdc_read_error_counters(struct drm_connector *connector, u16 counter[3]
> buf[i] = 0;
> buf[i + 1] = 0;
> }
> - buf[ARRAY_SIZE(buf) - 1] = 0;
> + buf[ERR_DET_OFF(SCDC_ERR_DET_CHECKSUM)] = 0;
> +
> + if (num_lanes == 4)
> + counter[3] = buf[ERR_DET_OFF(SCDC_ERR_DET_3_L)] |
> + (buf[ERR_DET_OFF(SCDC_ERR_DET_3_H)] & ~SCDC_CHANNEL_VALID) << 8;
> + else
> + counter[3] = 0;
I get that this is separate from the loop above because it's
discontiguous, but is it also missing the validity check? I mean,
lane_count == 3 means 'fsvo 3 which may be 1 or 2' so have to check
SCDC_CHANNEL_VALID there, but if we have 4 lanes explicitly specified
then we are we missing the check for the valid bit, or is it just
always valid / we shouldn't check?
tbh having it separately is a bit messy. I half-wonder if unrolling
the loop wouldn't be cleaner, e.g.:
#define GET_SCDC_ERR_CNT(c) { \
bool valid = (buf[(c) * 2 + 1] & SCDC_CHANNEL_VALID; \
if (valid) { \
counter[c] = buf[ERR_DET_OFF(SCDC_ERR_DET_ ##x _L)]; \
counter[c] |= (buf[ERR_DET_OFF(SCDC_ERR_DET_ ##x _H)]
& ~SCDC_CHANNEL_VALID) << 8; \
} else {
counter[c] = 0;
} \
}
GET_SCDC_ERR_CNT(0);
GET_SCDC_ERR_CNT(1);
GET_SCDC_ERR_CNT(2);
if (num_lanes == 4)
GET_SCDC_ERR_CNT(3);
else
counter[3] = 0;
Up to you though. It's a messy format, with no objectively great solution.
With or without that suggestion, series is:
Reviewed-by: Daniel Stone <daniels@collabora.com>
Thanks for pulling all this together!
Cheers,
Daniel
next prev parent reply other threads:[~2026-05-22 17:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-20 13:35 [PATCH v2 0/3] Add SCDC information to connector debugfs Nicolas Frattaroli
2026-05-20 13:35 ` [PATCH v2 1/3] drm/scdc-helper: Add scdc_status debugfs entry Nicolas Frattaroli
2026-05-25 11:49 ` Claude review: " Claude Code Review Bot
2026-05-20 13:35 ` [PATCH v2 2/3] drm/display: bridge_connector: init scdc debugfs for HDMI Nicolas Frattaroli
2026-05-25 11:49 ` Claude review: " Claude Code Review Bot
2026-05-20 13:35 ` [PATCH v2 3/3] drm/scdc-helper: Implement parsing and printing HDMI 2.1 fields Nicolas Frattaroli
2026-05-22 17:38 ` Daniel Stone [this message]
2026-05-25 11:49 ` Claude review: " Claude Code Review Bot
2026-05-25 11:49 ` Claude review: Add SCDC information to connector debugfs Claude Code Review Bot
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=CAPj87rMe_oOR66uBE1PpNq4oMgpw_XhAbQit3tohTQbUD2dPdQ@mail.gmail.com \
--to=daniel@fooishbar.org \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.ceresoli@bootlin.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=nicolas.frattaroli@collabora.com \
--cc=rfoss@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/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