Thread (3 messages) flat view 3 messages, 2 authors, 2025-07-09

Re: [PATCH] drm: rust: rename Device::as_ref() to Device::from_raw()

From: Alice Ryhl <aliceryhl@google.com>
Date: 2025-07-09 14:19:59
Also in: dri-devel, linux-pci, lkml, rust-for-linux

On Wed, Jul 9, 2025 at 4:07 PM Danilo Krummrich [off-list ref] wrote:
On Wed Jul 9, 2025 at 3:53 PM CEST, Alice Ryhl wrote:
quoted
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/aCZYcs6Aj-cz81qs@pollux (local)
I think the link you actually wanted to refer to is probably [1]. :)

[1] https://lore.kernel.org/all/aCd8D5IA0RXZvtcv@pollux/ (local)
I can update.
quoted
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Can you please split this patch up in one for the DRM renames, i.e. drm::Device,
gem::Object and drm::File, and one for device::Device?
Sure I will split into two patches.

Alice
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help