Thread (9 messages) flat view 9 messages, 4 authors, 2025-07-16

Re: [PATCH v2 2/2] drm: rust: rename as_ref() to from_raw() for drm constructors

From: "Benno Lossin" <lossin@kernel.org>
Date: 2025-07-11 09:11:40
Also in: dri-devel, linux-pci, lkml, rust-for-linux

On Fri Jul 11, 2025 at 10:04 AM CEST, Alice Ryhl wrote:
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 (local)
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Benno Lossin <lossin@kernel.org>

---
Cheers,
Benno
---
 rust/kernel/drm/device.rs  |  2 +-
 rust/kernel/drm/file.rs    |  8 ++++----
 rust/kernel/drm/gem/mod.rs | 16 ++++++++--------
 rust/kernel/drm/ioctl.rs   |  4 ++--
 4 files changed, 15 insertions(+), 15 deletions(-)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help