* [PATCH] rust: drm: fix incorrect type name in `Device` doc comment
@ 2026-04-29 5:08 Hsiu Che Yu
2026-04-29 8:20 ` Alice Ryhl
0 siblings, 1 reply; 4+ messages in thread
From: Hsiu Che Yu @ 2026-04-29 5:08 UTC (permalink / raw)
To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Trevor Gross, Maxime Ripard,
Asahi Lina, Lyude Paul
Cc: dri-devel, rust-for-linux, linux-kernel, stable, Hsiu Che Yu
The invariant documentation incorrectly referenced `struct device`
instead of `struct drm_device`. Fix it.
Fixes: 1e4b8896c0f3c ("rust: drm: add device abstraction")
Cc: stable@vger.kernel.org
Signed-off-by: Hsiu Che Yu <yu.whisper.personal@gmail.com>
---
| 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--git a/rust/kernel/drm/device.rs b/rust/kernel/drm/device.rs
index adbafe8db54d..301c9f7859e2 100644
--- a/rust/kernel/drm/device.rs
+++ b/rust/kernel/drm/device.rs
@@ -72,7 +72,7 @@ macro_rules! drm_legacy_fields {
///
/// # Invariants
///
-/// `self.dev` is a valid instance of a `struct device`.
+/// `self.dev` is a valid instance of a `struct drm_device`.
#[repr(C)]
pub struct Device<T: drm::Driver> {
dev: Opaque<bindings::drm_device>,
@@ -160,7 +160,7 @@ pub(crate) fn as_raw(&self) -> *mut bindings::drm_device {
/// # Safety
///
- /// `ptr` must be a valid pointer to a `struct device` embedded in `Self`.
+ /// `ptr` must be a valid pointer to a `struct drm_device` embedded in `Self`.
unsafe fn from_drm_device(ptr: *const bindings::drm_device) -> *mut Self {
// SAFETY: By the safety requirements of this function `ptr` is a valid pointer to a
// `struct drm_device` embedded in `Self`.
@@ -184,7 +184,7 @@ unsafe fn into_drm_device(ptr: NonNull<Self>) -> *mut bindings::drm_device {
/// to can't drop to zero, for the duration of this function call and the entire duration when
/// the returned reference exists.
///
- /// Additionally, callers must ensure that the `struct device`, `ptr` is pointing to, is
+ /// Additionally, callers must ensure that the `struct drm_device`, `ptr` is pointing to, is
/// embedded in `Self`.
#[doc(hidden)]
pub unsafe fn from_raw<'a>(ptr: *const bindings::drm_device) -> &'a Self {
---
base-commit: b4e07588e743c989499ca24d49e752c074924a9a
change-id: 20260429-fix-drm-device-comment-41859883dcfb
Best regards,
--
Hsiu Che Yu <yu.whisper.personal@gmail.com>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] rust: drm: fix incorrect type name in `Device` doc comment
2026-04-29 5:08 [PATCH] rust: drm: fix incorrect type name in `Device` doc comment Hsiu Che Yu
@ 2026-04-29 8:20 ` Alice Ryhl
2026-05-05 1:51 ` Claude review: " Claude Code Review Bot
2026-05-05 1:51 ` Claude Code Review Bot
0 siblings, 2 replies; 4+ messages in thread
From: Alice Ryhl @ 2026-04-29 8:20 UTC (permalink / raw)
To: Hsiu Che Yu
Cc: Danilo Krummrich, David Airlie, Simona Vetter, Miguel Ojeda,
Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Trevor Gross, Maxime Ripard, Asahi Lina,
Lyude Paul, dri-devel, rust-for-linux, linux-kernel, stable
On Wed, Apr 29, 2026 at 01:08:14PM +0800, Hsiu Che Yu wrote:
> The invariant documentation incorrectly referenced `struct device`
> instead of `struct drm_device`. Fix it.
>
> Fixes: 1e4b8896c0f3c ("rust: drm: add device abstraction")
> Cc: stable@vger.kernel.org
> Signed-off-by: Hsiu Che Yu <yu.whisper.personal@gmail.com>
LGTM
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Claude review: Re: [PATCH] rust: drm: fix incorrect type name in `Device` doc comment
2026-04-29 8:20 ` Alice Ryhl
2026-05-05 1:51 ` Claude review: " Claude Code Review Bot
@ 2026-05-05 1:51 ` Claude Code Review Bot
1 sibling, 0 replies; 4+ messages in thread
From: Claude Code Review Bot @ 2026-05-05 1:51 UTC (permalink / raw)
To: dri-devel-reviews
Overall Series Review
Subject: Re: [PATCH] rust: drm: fix incorrect type name in `Device` doc comment
Author: Alice Ryhl <aliceryhl@google.com>
Patches: 2
Reviewed: 2026-05-05T11:51:05.636703
---
This is a single-patch documentation fix that corrects three instances where `struct device` was incorrectly written in doc comments instead of `struct drm_device` in `rust/kernel/drm/device.rs`. The fix is trivially correct and clearly beneficial.
**Verdict: Looks good.** The patch is minimal, accurate, and well-targeted. The `Fixes:` tag and `Cc: stable` are appropriate since these are doc comments that describe safety invariants — incorrect safety documentation in Rust `unsafe` code could mislead a developer into providing the wrong pointer type.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 4+ messages in thread
* Claude review: Re: [PATCH] rust: drm: fix incorrect type name in `Device` doc comment
2026-04-29 8:20 ` Alice Ryhl
@ 2026-05-05 1:51 ` Claude Code Review Bot
2026-05-05 1:51 ` Claude Code Review Bot
1 sibling, 0 replies; 4+ messages in thread
From: Claude Code Review Bot @ 2026-05-05 1:51 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
**All three hunks are correct.**
**Hunk 1 — Invariant comment (line 75 in tree):**
```
-/// `self.dev` is a valid instance of a `struct device`.
+/// `self.dev` is a valid instance of a `struct drm_device`.
```
The `dev` field is declared as `Opaque<bindings::drm_device>`, so `struct drm_device` is the correct type. This is the struct-level invariant, so accuracy matters for anyone relying on it when writing `unsafe` code.
**Hunk 2 — Safety doc on `from_drm_device` (line 163 in tree):**
```
- /// `ptr` must be a valid pointer to a `struct device` embedded in `Self`.
+ /// `ptr` must be a valid pointer to a `struct drm_device` embedded in `Self`.
```
The function signature takes `*const bindings::drm_device`, and the internal `// SAFETY:` comment on line 166 already correctly says `struct drm_device`. The doc comment was the only inconsistent part.
**Hunk 3 — Safety doc on `from_raw` (line 187 in tree):**
```
- /// Additionally, callers must ensure that the `struct device`, `ptr` is pointing to, is
+ /// Additionally, callers must ensure that the `struct drm_device`, `ptr` is pointing to, is
```
Same situation — `ptr` is `*const bindings::drm_device`, and the function delegates to `from_drm_device`. The doc comment was the sole inconsistency.
**No issues found.** The patch is correct, complete (all three erroneous instances are fixed), and the commit message is clear. The `Fixes:` tag correctly references the commit that introduced the abstraction (and these comments).
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-05-05 1:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-29 5:08 [PATCH] rust: drm: fix incorrect type name in `Device` doc comment Hsiu Che Yu
2026-04-29 8:20 ` Alice Ryhl
2026-05-05 1:51 ` Claude review: " Claude Code Review Bot
2026-05-05 1:51 ` Claude Code Review Bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox