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

Alice Ryhl aliceryhl at google.com
Wed Jul 9 14:19:45 UTC 2025


On Wed, Jul 9, 2025 at 4:07 PM Danilo Krummrich <dakr at kernel.org> wrote:
>
> On Wed Jul 9, 2025 at 3:53 PM 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/aCZYcs6Aj-cz81qs@pollux
>
> I think the link you actually wanted to refer to is probably [1]. :)
>
> [1] https://lore.kernel.org/all/aCd8D5IA0RXZvtcv@pollux/

I can update.

> > Signed-off-by: Alice Ryhl <aliceryhl at 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


More information about the dri-devel mailing list