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: Re: [PATCH] drm/amdgpu: use ACK polling for page-write completion
Date: Thu, 04 Jun 2026 14:17:39 +1000	[thread overview]
Message-ID: <review-patch2-3206d5c3e94f694b4f0a5b5db4dc1ebaaa86aac9@intel.com> (raw)
In-Reply-To: <3206d5c3e94f694b4f0a5b5db4dc1ebaaa86aac9@intel.com>

Patch Review

**Correctness: Good.** The `read_poll_timeout()` usage is correct:

```c
ret = read_poll_timeout(i2c_transfer, r,
                         r == 1,
                         200, 10 * USEC_PER_MSEC,
                         false,
                         i2c_adap, &msgs[0], 1);
```

- `op = i2c_transfer`, called as `r = i2c_transfer(i2c_adap, &msgs[0], 1)` — polls with a single-message (offset-only) write, which is the correct ACK polling probe when the adapter doesn't support zero-length transfers.
- `cond = r == 1` — correct: `i2c_transfer` returns the number of messages transferred on success.
- `sleep_us = 200` — internally uses `usleep_range(51, 200)` between polls. Reasonable: at worst ~50 polls over 10 ms.
- `timeout_us = 10 * USEC_PER_MSEC` — preserves the existing 10 ms upper bound.
- `sleep_before_read = false` — first poll is immediate. An initial sleep might save one wasted I2C transaction (the EEPROM is definitely busy right after the write), but the overhead is negligible.

**Error handling: Correct.** After timeout, `read_poll_timeout()` returns `-ETIMEDOUT`, the code breaks out of the for loop, and `r` holds the last `i2c_transfer` return value (typically `-ENXIO` from NACK), which propagates correctly through:

```c
return r < 0 ? r : eeprom_buf - p;
```

**Variable reuse — minor concern.** The macro writes into `r`, which is also the outer for-loop's transfer result variable. This works correctly because:
- On successful poll: `r == 1`, the loop continues, and the next iteration overwrites `r` with the actual two-message transfer result before checking it.
- On last page (loop exits with `buf_size == 0`): `r == 1 >= 0`, so the byte count `eeprom_buf - p` is returned, which is correct.

However, this coupling is subtle. A reader seeing `r` used for both `ARRAY_SIZE(msgs)==2` success checks and `==1` polling success needs to trace through carefully. It's not wrong, but worth being aware of. If the maintainers prefer, the `read_poll_timeout` could use the local `ret` variable instead and set `r` explicitly on error:

```c
read_poll_timeout(i2c_transfer, ret,
                   ret == 1, ...);
if (ret != 1) {
    r = ret;
    break;
}
```

But this is a style nit, not a correctness issue.

**Comment quality: Good.** The block comment explaining why an offset-only dummy write is used instead of a zero-length probe, and why the address pointer update is harmless, is helpful and well-written.

**Include addition: Correct.** `<linux/iopoll.h>` is needed for `read_poll_timeout()` and is properly placed before the local headers.

**Commit message: Good.** Clear description of what and why, appropriate `Suggested-by` tag, v2 changelog, and test information (MI200/ALDEBARAN with `ras_eeprom_reset`).

**Verdict:** v2 looks good to me. The `read_poll_timeout()` usage is correct, error paths are sound, and the approach follows standard EEPROM practice. The variable reuse is the only subtle point but works correctly as-is.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-06-04  4:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-01  9:32 [PATCH] drm/amdgpu: use ACK polling for page-write completion Kunal Zodape
2026-06-01  9:57 ` Jani Nikula
2026-06-04  4:17   ` Claude Code Review Bot [this message]
2026-06-01 11:23 ` [PATCH v2] " Kunal Zodape
2026-06-01 13:05   ` Lazar, Lijo
2026-06-02  6:10     ` Devanand Zodape, Kunal
2026-06-02  6:31       ` Lazar, Lijo
2026-06-04  4:17 ` Claude review: " Claude Code Review Bot
2026-06-04  4:17 ` 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-patch2-3206d5c3e94f694b4f0a5b5db4dc1ebaaa86aac9@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