From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: rust: drm: Pass bound parent device to ioctl handlers
Date: Thu, 07 May 2026 12:45:10 +1000 [thread overview]
Message-ID: <review-patch6-20260506221027.858481-7-dakr@kernel.org> (raw)
In-Reply-To: <20260506221027.858481-7-dakr@kernel.org>
Patch Review
The final ioctl call becomes:
```rust
match $func(dev, &*guard, guard.registration_data(), data, file) {
```
**`&*guard` usage**: This dereferences the `UnbindGuard` through its `Deref` impl to get `&T::ParentDevice<Bound>`, then re-borrows it. This is correct.
**Borrow concern**: Both `&*guard` and `guard.registration_data()` borrow the guard simultaneously — the first immutably through `Deref`, the second through a method call. Since both are immutable borrows, this is fine from a borrow-checking perspective. However, `registration_data()` internally calls `self.dev.raw_registration_data()`, which goes through `UnsafeCell::get()`. The safety here relies on the fact that no mutable access to `registration_data` occurs during the SRCU critical section, which is guaranteed because `Registration::drop` calls `drm_dev_unplug()` (SRCU barrier) before modifying anything.
**Driver-side changes**: Nova and tyr add the parent device parameter (`_adev: &auxiliary::Device<Bound>` and `_pdev: &platform::Device<device::Bound>` respectively). These are unused with `_` prefix, which is expected for this infrastructure patch.
**Argument order**: The final ioctl handler signature is:
```
fn foo(dev, parent_device, reg_data, ioctl_data, file) -> Result<u32>
```
This is a 5-argument function. While not a problem per se, it's worth considering if a context struct would be cleaner for future evolution. But for now, this is fine.
**Minor nit**: The imports in `nova/file.rs` add `auxiliary` and `device::Bound` — straightforward.
No blocking issues.
### Summary
The series is well-designed with careful safety arguments. The main architectural dependency is on the `ForLt` trait and `DeviceContext` work that isn't in drm-next yet. The `drm_dev_unregister` → `drm_dev_unplug` switch is the key safety enabler and is correct. The lifetime erasure/recovery pattern via `mem::transmute` is the most subtle part but is justified by `ForLt`'s covariance guarantee. The incremental ioctl handler signature evolution across patches 4-6 is clean. No blocking issues found.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-05-07 2:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-06 22:05 [PATCH 0/6] rust: drm: Higher-Ranked Lifetime private data Danilo Krummrich
2026-05-06 22:05 ` [PATCH 1/6] rust: drm: Add Driver::ParentDevice associated type Danilo Krummrich
2026-05-07 2:45 ` Claude review: " Claude Code Review Bot
2026-05-06 22:06 ` [PATCH 2/6] rust: drm: Add UnbindGuard for drm_dev_enter/exit critical sections Danilo Krummrich
2026-05-07 2:45 ` Claude review: " Claude Code Review Bot
2026-05-06 22:06 ` [PATCH 3/6] rust: drm: Add RegistrationData to drm::Driver Danilo Krummrich
2026-05-07 2:45 ` Claude review: " Claude Code Review Bot
2026-05-06 22:06 ` [PATCH 4/6] rust: drm: Wrap ioctl dispatch in UnbindGuard Danilo Krummrich
2026-05-07 2:45 ` Claude review: " Claude Code Review Bot
2026-05-06 22:06 ` [PATCH 5/6] rust: drm: Pass registration data to ioctl handlers Danilo Krummrich
2026-05-07 2:45 ` Claude review: " Claude Code Review Bot
2026-05-06 22:06 ` [PATCH 6/6] rust: drm: Pass bound parent device " Danilo Krummrich
2026-05-07 2:45 ` Claude Code Review Bot [this message]
2026-05-07 2:45 ` Claude review: rust: drm: Higher-Ranked Lifetime private data 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-patch6-20260506221027.858481-7-dakr@kernel.org \
--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