From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/connector: Add a 'link bpc' property
Date: Sun, 22 Mar 2026 04:19:40 +1000 [thread overview]
Message-ID: <review-patch1-20260319-link-bpc-v5-1-5306cd04a708@collabora.com> (raw)
In-Reply-To: <20260319-link-bpc-v5-1-5306cd04a708@collabora.com>
Patch Review
**Timing issue in commit_tail (major concern):**
The patch inserts the link_bpc property update and uevent between `drm_atomic_helper_wait_for_dependencies()` and the `atomic_commit_tail()` call:
```c
drm_atomic_helper_wait_for_dependencies(state);
for_each_oldnew_connector_in_state(state, connector, old_conn_state,
new_conn_state, i) {
if (old_conn_state->link_bpc != new_conn_state->link_bpc)
drm_connector_update_link_bpc_property(connector,
new_conn_state);
}
/* ... then atomic_commit_tail() actually programs hardware */
```
This fires the uevent *before* the hardware has been programmed. Userspace reacting to the uevent could query the property and see the new value while the hardware is still at the old state. The property update and uevent should be moved to *after* `atomic_commit_tail()` returns (but before `drm_atomic_helper_commit_cleanup_done()`). That would match the pattern used by `drm_hdcp_update_content_protection` where the property is updated after the HW state is known.
**clamp() type mismatch:**
```c
u8 bpc = clamp(state->link_bpc, 8, state->max_bpc);
```
`state->link_bpc` is `u8`, `state->max_bpc` is `u8`, but the literal `8` is `int`. The kernel's `clamp()` macro has strict type checking and this will likely generate a compiler warning or error. Should be `clamp_t(u8, state->link_bpc, 8, state->max_bpc)` or use a `(u8)8` cast.
**Unconditional uevent on every link_bpc change:**
`drm_connector_update_link_bpc_property()` always fires a uevent via `drm_sysfs_connector_property_event()`. The caller in `commit_tail` already checks `old_conn_state->link_bpc != new_conn_state->link_bpc`, so the uevent is conditional on an actual change — that's good. However, the function itself doesn't gate on the property having actually changed from the connector object's perspective (via `drm_object_property_set_value`). If `drm_connector_update_link_bpc_property` is ever called from another path where the value hasn't changed, it would fire a spurious uevent. Consider adding a check inside the function, or document that callers must check for changes first.
**Missing `int i` declaration:**
The patch adds `for_each_oldnew_connector_in_state(state, connector, old_conn_state, new_conn_state, i)` in `commit_tail()` but the loop variable `i` is already declared on line 2042 as `unsigned int i` (shared with the self_refresh loop). This works, but only because the existing `i` is `unsigned int` which matches what the macro expects.
**Return value of `drm_connector_attach_link_bpc_property` returns int:**
This function returns `int` (error codes), while the existing `drm_connector_attach_max_bpc_property()` also returns `int`. This is fine, but callers need to check it — see patch 3 comments.
**Minor nit — double space in doc:**
```c
* @max_bpc: specify the upper limit, matching that of 'max bpc' property
```
Extra space before "that".
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-03-21 18:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-19 12:28 [PATCH v5 0/3] Add "link bpc" DRM property Nicolas Frattaroli
2026-03-19 12:28 ` [PATCH v5 1/3] drm/connector: Add a 'link bpc' property Nicolas Frattaroli
2026-03-21 18:19 ` Claude Code Review Bot [this message]
2026-03-19 12:28 ` [PATCH v5 2/3] drm/connector: hdmi: Add support for " Nicolas Frattaroli
2026-03-21 18:19 ` Claude review: " Claude Code Review Bot
2026-03-19 12:28 ` [PATCH v5 3/3] drm/amd/display: " Nicolas Frattaroli
2026-03-21 18:19 ` Claude review: " Claude Code Review Bot
2026-03-20 14:32 ` [PATCH v5 0/3] Add "link bpc" DRM property Michel Dänzer
2026-03-20 18:02 ` Nicolas Frattaroli
2026-03-21 2:33 ` Mario Kleiner
2026-03-21 18:19 ` Claude review: " 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-20260319-link-bpc-v5-1-5306cd04a708@collabora.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