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/probe-helper: honour connector->force in drm_helper_probe_detect()
Date: Wed, 27 May 2026 14:37:44 +1000	[thread overview]
Message-ID: <review-patch1-20260526152025.12530-2-pmenzel@molgen.mpg.de> (raw)
In-Reply-To: <20260526152025.12530-2-pmenzel@molgen.mpg.de>

Patch Review

**Correctness — epoch counter not updated on first call (minor issue)**

When `drm_helper_probe_detect()` is called via the `ctx != NULL` path, the existing code bumps `epoch_counter` when the returned status differs from `connector->status`:

```c
if (ret != connector->status)
    connector->epoch_counter += 1;
```

The new early return skips this entirely. On the very first call (when `connector->status` is `connector_status_unknown` and force is `DRM_FORCE_OFF`), the returned `connector_status_disconnected` differs from the stored status but the epoch counter is not bumped. This means callers like `check_connector_changed()` (line 988) won't see the status transition:

```c
connector->status = drm_helper_probe_detect(connector, NULL, false);
if (old_epoch_counter == connector->epoch_counter) {
    ...
    return false;
}
```

In practice this is likely benign — the initial status update for forced connectors typically happens through `drm_helper_probe_single_connector_modes()` which sets `connector->status` directly (line 592-594) before ever reaching this path. But it would be more robust to update the epoch counter in the early-return path too, matching the existing pattern. Consider:

```c
if (connector->force) {
    int status;

    drm_dbg_kms(dev, "[CONNECTOR:%d:%s] force=%d, skipping detect\n",
                connector->base.id, connector->name,
                connector->force);
    if (connector->force == DRM_FORCE_ON ||
        connector->force == DRM_FORCE_ON_DIGITAL)
        status = connector_status_connected;
    else
        status = connector_status_disconnected;
    if (status != connector->status)
        connector->epoch_counter += 1;
    return status;
}
```

**The `ctx == NULL` path — `drm_helper_probe_detect_ctx()` also has epoch counter logic**

When `ctx` is NULL, the code falls through to `drm_helper_probe_detect_ctx()` which has its own `epoch_counter` bump at line 377-378. The new early return is placed *before* the `ctx` dispatch, so it correctly covers both paths. Good.

**Style nit — `else` after `return`**

The `else` on line 108 is unnecessary since the `if` branch returns:

```c
if (connector->force == DRM_FORCE_ON ||
    connector->force == DRM_FORCE_ON_DIGITAL)
    return connector_status_connected;
else
    return connector_status_disconnected;
```

This does match the pattern used in `drm_helper_probe_single_connector_modes()` (line 590-594) which also uses if/else, so it's consistent with existing code style. Not a blocker, but it could be simplified to just:

```c
if (connector->force == DRM_FORCE_ON ||
    connector->force == DRM_FORCE_ON_DIGITAL)
    return connector_status_connected;
return connector_status_disconnected;
```

**Debug message format — `force=%d`**

Printing the raw enum value (`force=%d`) is functional but not immediately readable in logs. The log output `force=1` means `DRM_FORCE_OFF` (since `UNSPECIFIED=0, OFF=1, ON=2, ON_DIGITAL=3`). This is fine for developers who know the enum, but a human-readable string would be friendlier. Minor nit, not a blocker.

**Overall assessment**: The patch is correct and addresses a real issue. The epoch counter concern is the only substantive point — it should either be handled or explicitly called out as intentionally skipped. With that addressed, this is a clean, well-motivated fix.

---
Generated by Claude Code Patch Reviewer

  parent reply	other threads:[~2026-05-27  4:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26 15:20 [PATCH] drm/probe-helper: honour connector->force in drm_helper_probe_detect() Paul Menzel
2026-05-26 16:58 ` Jani Nikula
2026-05-27  4:37 ` Claude review: " Claude Code Review Bot
2026-05-27  4:37 ` Claude Code Review Bot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-05-26 19:18 [PATCH v2] " Paul Menzel
2026-05-27  4:18 ` Claude review: " Claude Code Review Bot
2026-05-27  4:18 ` Claude Code Review Bot
2026-05-26 22:32 [PATCH v3] drm/probe-helper: Honour " Paul Menzel
2026-05-27  3:57 ` Claude review: " Claude Code Review Bot
2026-05-27  3:57 ` 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-20260526152025.12530-2-pmenzel@molgen.mpg.de \
    --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