From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/panthor: Use the drm_dev_access guard
Date: Sat, 16 May 2026 11:40:46 +1000 [thread overview]
Message-ID: <review-patch5-20260513-panthor-guard-refactor-v1-5-f2d8c15a97ce@collabora.com> (raw)
In-Reply-To: <20260513-panthor-guard-refactor-v1-5-f2d8c15a97ce@collabora.com>
Patch Review
Clean application of the drm_dev_access guard from patch 3. Several patterns emerge:
**IOCTL paths using `ACQUIRE`/`ACQUIRE_ERR`:**
```c
ACQUIRE(drm_dev_access, dev_guard)(ddev);
if (ACQUIRE_ERR(drm_dev_access, &dev_guard))
return -ENODEV;
```
This is verbose compared to the old `if (!drm_dev_enter(ddev, &cookie)) return -ENODEV;` — it's 2 lines vs 2 lines but with longer names. The payoff is removing the `drm_dev_exit(cookie)` and any gotos to it.
**`panthor_device_resume()` — `scoped_cond_guard` with `ret = 0` fallthrough:**
```c
scoped_cond_guard(drm_dev_access, ret = 0, &ptdev->base) {
```
When `drm_dev_enter` fails (device unplugged), `ret` is set to 0 and the block is skipped. This is correct — the original code also just skipped the block with `drm_dev_enter()` returning false.
**`panthor_device_suspend()` — `scoped_guard` without error action:**
```c
scoped_guard(drm_dev_access, &ptdev->base) {
```
Using `scoped_guard` (not `scoped_cond_guard`) means if `drm_dev_enter` fails, the block is silently skipped. The original code had the same behavior (`if (...drm_dev_enter(...))`). This is correct for suspend — if the device is already unplugged, skipping teardown is fine.
**`panthor_vm_active()` simplification:**
The conversion from:
```c
scoped_guard(mutex, &vm->op_lock) {
guard(mutex)(&ptdev->mmu->as.slots_lock);
ret = panthor_vm_active_locked(vm);
}
```
to:
```c
guard(mutex)(&vm->op_lock);
guard(mutex)(&ptdev->mmu->as.slots_lock);
return panthor_vm_active_locked(vm);
```
This is functionally equivalent since we're at the end of the function either way. Cleaner.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-05-16 1:40 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-13 16:58 [PATCH 0/6] drm/panthor: Use guards Boris Brezillon
2026-05-13 16:58 ` [PATCH 1/6] drm/panthor: Driver-wide xxx_[un]lock -> [scoped_]guard replacement Boris Brezillon
2026-05-14 13:16 ` Steven Price
2026-05-14 17:09 ` Chia-I Wu
2026-05-16 1:40 ` Claude review: " Claude Code Review Bot
2026-05-13 16:58 ` [PATCH 2/6] dma-resv: Define guards for context-less dma_resv locks Boris Brezillon
2026-05-14 18:23 ` Chia-I Wu
2026-05-16 1:40 ` Claude review: " Claude Code Review Bot
2026-05-13 16:58 ` [PATCH 3/6] drm: Define a conditional guard for drm_dev_{enter,exit}() Boris Brezillon
2026-05-14 18:34 ` [PATCH 3/6] drm: Define a conditional guard for drm_dev_{enter, exit}() Chia-I Wu
2026-05-16 1:40 ` Claude review: drm: Define a conditional guard for drm_dev_{enter,exit}() Claude Code Review Bot
2026-05-13 16:58 ` [PATCH 4/6] drm/panthor: Use guards for resv locking Boris Brezillon
2026-05-14 18:35 ` Chia-I Wu
2026-05-16 1:40 ` Claude review: " Claude Code Review Bot
2026-05-13 16:58 ` [PATCH 5/6] drm/panthor: Use the drm_dev_access guard Boris Brezillon
2026-05-14 18:36 ` Chia-I Wu
2026-05-16 1:40 ` Claude Code Review Bot [this message]
2026-05-13 16:58 ` [PATCH 6/6] drm/panthor: Add a new guard for our custom resume_and_get() PM helper Boris Brezillon
2026-05-14 18:39 ` Chia-I Wu
2026-05-16 1:40 ` Claude review: " Claude Code Review Bot
2026-05-16 1:40 ` Claude review: drm/panthor: Use guards 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-patch5-20260513-panthor-guard-refactor-v1-5-f2d8c15a97ce@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