public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/display/dp: Export function to wake the sink AUX_CH
Date: Tue, 10 Mar 2026 12:41:16 +1000	[thread overview]
Message-ID: <review-patch1-20260309-dp_aux_timeout-v1-1-08c610a63a84@intel.com> (raw)
In-Reply-To: <20260309-dp_aux_timeout-v1-1-08c610a63a84@intel.com>

Patch Review

**`poll_timeout_us` misuse:**

```c
ret = poll_timeout_us(ret = drm_dp_dpcd_readb(aux, DP_SET_POWER, &value),
                      ret > 0,
                      1000, wake_retry * 1000, true);
```

The variable `ret` is used both as the operation result (inside the macro expansion) AND as the macro's return value. After the macro completes, `ret` holds the macro's return value (0 or `-ETIMEDOUT`), not the `drm_dp_dpcd_readb` return value. This means the `ret < 0` check below is only checking for `-ETIMEDOUT` from the poll, not a DPCD read failure. This is confusing and fragile — use a separate variable for the poll result.

**Condition logic concern:**

```c
if (value == DP_SET_POWER_D3 || ret < 0) {
```

If the poll times out (ret == -ETIMEDOUT), `value` might contain stale or partial data from a failed read. The function proceeds to write to `DP_SET_POWER` without checking whether DPCD writes actually succeed — no error checking on either `drm_dp_dpcd_writeb` call.

**Wake sequence concern:**

```c
drm_dp_dpcd_writeb(aux, DP_SET_POWER, DP_SET_POWER_D0);
fsleep(1000);
drm_dp_dpcd_writeb(aux, DP_SET_POWER, DP_SET_POWER_D3_AUX_ON);
```

Setting to D0 and then immediately to D3_AUX_ON seems odd. The cover letter and spec reference (Section 2.3.4) say the goal is to wake the sink for AUX communication, but D3_AUX_ON is still a low-power state. If the caller is about to retry an AUX transaction, why not leave it in D0? The intent should be clarified.

**Missing `#include`:** The function uses `poll_timeout_us` from `<linux/iopoll.h>` and `fsleep`. Ensure the drm_dp_helper.c file includes the necessary headers.

**Naming:** `drm_dp_wake_sink` is generic but it specifically deals with AUX channel power states. A name like `drm_dp_aux_wake_sink` might be more precise.

**Documentation:** The kerneldoc is incomplete — it should describe the behavior (what it does on success/failure, return value semantics — though it's void).

---

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-03-10  2:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-09  7:29 [PATCH RFC 0/3] Some updates over DP AUX Transactions Arun R Murthy
2026-03-09  7:29 ` [PATCH RFC 1/3] drm/display/dp: Export function to wake the sink AUX_CH Arun R Murthy
2026-03-10  2:41   ` Claude Code Review Bot [this message]
2026-03-09  7:29 ` [PATCH RFC 2/3] drm/i915/dp: On AUX_CH tx timeout, wake up the sink Arun R Murthy
2026-03-10  2:41   ` Claude review: " Claude Code Review Bot
2026-03-09  7:29 ` [PATCH RFC 3/3] drm/i915/dp: Configure PORT_AUX_CTL and then trigger the tx Arun R Murthy
2026-03-09 13:09   ` Jani Nikula
2026-03-09 13:20     ` Murthy, Arun R
2026-03-10  2:41   ` Claude review: " Claude Code Review Bot
2026-03-10  2:41 ` Claude review: Some updates over DP AUX Transactions 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=review-patch1-20260309-dp_aux_timeout-v1-1-08c610a63a84@intel.com \
    --to=claude-review@example.com \
    --cc=dri-devel-reviews@example.com \
    /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