Re: [PATCH v2 1/2] device: rust: rename Device::as_ref() to Device::from_raw()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Reviewed-by: Benno Lossin <lossin@xxxxxxxxxx>

---
Cheers,
Benno

> ---
>  rust/kernel/auxiliary.rs  | 2 +-
>  rust/kernel/cpu.rs        | 2 +-
>  rust/kernel/device.rs     | 6 +++---
>  rust/kernel/drm/device.rs | 2 +-
>  rust/kernel/faux.rs       | 2 +-
>  rust/kernel/miscdevice.rs | 2 +-
>  rust/kernel/net/phy.rs    | 2 +-
>  rust/kernel/pci.rs        | 2 +-
>  rust/kernel/platform.rs   | 2 +-
>  9 files changed, 11 insertions(+), 11 deletions(-)





[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux