diff options
author | Alice Ryhl <aliceryhl@google.com> | 2025-07-11 08:04:38 +0000 |
---|---|---|
committer | Danilo Krummrich <dakr@kernel.org> | 2025-07-11 16:30:30 +0200 |
commit | 917b10d90990fd2138b5dbc2d22cfa428c070ade (patch) | |
tree | 125d85270eb64391c80b7cb45b45eccc2e388ce0 /rust/kernel/drm/device.rs | |
parent | 667efb341917bde19f5d7517b65defcdaed67c9e (diff) |
drm: rust: rename as_ref() to from_raw() for drm constructors
The prefix as_* should not be used for a constructor. Constructors
usually use the prefix from_* instead.
Some prior art in the stdlib: Box::from_raw, CString::from_raw,
Rc::from_raw, Arc::from_raw, Waker::from_raw, File::from_raw_fd.
There is also prior art in the kernel crate: cpufreq::Policy::from_raw,
fs::File::from_raw_file, Kuid::from_raw, ARef::from_raw,
SeqFile::from_raw, VmaNew::from_raw, Io::from_raw.
Link: https://lore.kernel.org/r/aCd8D5IA0RXZvtcv@pollux
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Link: https://lore.kernel.org/r/20250711-device-as-ref-v2-2-1b16ab6402d7@google.com
Diffstat (limited to 'rust/kernel/drm/device.rs')
-rw-r--r-- | rust/kernel/drm/device.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/rust/kernel/drm/device.rs b/rust/kernel/drm/device.rs index 624d7a4c83ea..98418f4ce625 100644 --- a/rust/kernel/drm/device.rs +++ b/rust/kernel/drm/device.rs @@ -154,7 +154,7 @@ impl<T: drm::Driver> Device<T> { /// Additionally, callers must ensure that the `struct device`, `ptr` is pointing to, is /// embedded in `Self`. #[doc(hidden)] - pub unsafe fn as_ref<'a>(ptr: *const bindings::drm_device) -> &'a Self { + pub unsafe fn from_raw<'a>(ptr: *const bindings::drm_device) -> &'a Self { // SAFETY: By the safety requirements of this function `ptr` is a valid pointer to a // `struct drm_device` embedded in `Self`. let ptr = unsafe { Self::from_drm_device(ptr) }; |