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/bridge: display-connector: trigger initial HPD event for DP
Date: Sat, 16 May 2026 11:28:16 +1000	[thread overview]
Message-ID: <review-patch2-20260513-dp-connector-hpd-v2-2-42f757bfcbf9@oss.qualcomm.com> (raw)
In-Reply-To: <20260513-dp-connector-hpd-v2-2-42f757bfcbf9@oss.qualcomm.com>

Patch Review

**Purpose:** After enabling HPD, schedule a work item to send the current cable status for DP connectors, so that cables plugged before boot are detected.

**Analysis:**

The work_struct approach is the correct design. Calling `drm_bridge_hpd_notify()` directly from `hpd_enable` would deadlock on `bridge->hpd_mutex`. The deferred work runs in system workqueue context where the mutex is not held:

```c
static void display_connector_hpd_work(struct work_struct *work)
{
	struct display_connector *conn = container_of(work, struct display_connector, hpd_work);
	struct drm_bridge *bridge = &conn->bridge;
	drm_bridge_hpd_notify(bridge, display_connector_detect(bridge));
}
```

`display_connector_detect()` calls `gpiod_get_value_cansleep()`, which is fine from workqueue context (can sleep).

The ordering in `hpd_disable` is correct — cancel the work before disabling the IRQ:

```c
if (conn->bridge.type == DRM_MODE_CONNECTOR_DisplayPort)
	cancel_work_sync(&conn->hpd_work);
disable_irq(conn->hpd_irq);
```

`cancel_work_sync` ensures the work has either completed or been cancelled before proceeding, preventing a use-after-disable scenario.

The conditional `INIT_WORK` in probe:

```c
if (conn->hpd_irq >= 0 && type == DRM_MODE_CONNECTOR_DisplayPort)
	INIT_WORK(&conn->hpd_work, display_connector_hpd_work);
```

is consistent with the conditional usage in `hpd_enable`/`hpd_disable` — both check `conn->bridge.type == DRM_MODE_CONNECTOR_DisplayPort`.

**Minor concern — teardown safety:** `display_connector_remove()` does not call `cancel_work_sync()`. This relies on the DRM framework calling `drm_bridge_hpd_disable()` (which calls `hpd_disable` → `cancel_work_sync`) before the bridge is removed. This is the expected teardown order and is how other bridge drivers work, so it's acceptable. Adding a defensive cancel in `remove()` would be difficult anyway since the work is only initialized for DP connectors.

**Commit message typos:**

```
Note, thia issue only affects drivers which set OP_HPD but not OP_DETECT
```
"thia" → "this"

```
The HPD pin state is equalc to the display plugged state.
```
"equalc" → "equal"

**No functional issues found. Two trivial typos in the commit message.**

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-05-16  1:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-13 18:19 [PATCH v2 0/2] drm/bridge: display-connector: detect DP state if cable is plugged on boot Dmitry Baryshkov
2026-05-13 18:19 ` [PATCH v2 1/2] drm/bridge: display-connector: don't autoenable HPD IRQ Dmitry Baryshkov
2026-05-16  1:28   ` Claude review: " Claude Code Review Bot
2026-05-13 18:19 ` [PATCH v2 2/2] drm/bridge: display-connector: trigger initial HPD event for DP Dmitry Baryshkov
2026-05-16  1:28   ` Claude Code Review Bot [this message]
2026-05-16  1:28 ` Claude review: drm/bridge: display-connector: detect DP state if cable is plugged on boot Claude Code Review Bot
  -- strict thread matches above, loose matches on Subject: below --
2026-03-14  0:43 [PATCH 0/2] " Dmitry Baryshkov
2026-03-14  0:43 ` [PATCH 2/2] drm/bridge: display-connector: trigger initial HPD event for DP Dmitry Baryshkov
2026-03-16  2:14   ` 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-patch2-20260513-dp-connector-hpd-v2-2-42f757bfcbf9@oss.qualcomm.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