rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Rename Device::as_ref() to from_raw()
@ 2025-07-11  8:04 Alice Ryhl
  2025-07-11  8:04 ` [PATCH v2 1/2] device: rust: rename Device::as_ref() to Device::from_raw() Alice Ryhl
  2025-07-11  8:04 ` [PATCH v2 2/2] drm: rust: rename as_ref() to from_raw() for drm constructors Alice Ryhl
  0 siblings, 2 replies; 9+ messages in thread
From: Alice Ryhl @ 2025-07-11  8:04 UTC (permalink / raw)
  To: Danilo Krummrich
  Cc: Greg Kroah-Hartman, Dave Ertman, Ira Weiny, Leon Romanovsky,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Trevor Gross, Thomas Gleixner,
	Peter Zijlstra, Rafael J. Wysocki, David Airlie, Simona Vetter,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	FUJITA Tomonori, Bjorn Helgaas, Krzysztof Wilczyński,
	rust-for-linux, linux-kernel, dri-devel, netdev, linux-pci,
	Alice Ryhl

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.

For more, see: https://lore.kernel.org/r/aCd8D5IA0RXZvtcv@pollux

Signed-off-by: Alice Ryhl <aliceryhl@google.com>
---
Changes in v2:
- Split into two patches.
- Use a different lore link.
- Link to v1: https://lore.kernel.org/r/20250709-device-as-ref-v1-1-ebf7059ffa9c@google.com

---
Alice Ryhl (2):
      device: rust: rename Device::as_ref() to Device::from_raw()
      drm: rust: rename as_ref() to from_raw() for drm constructors

 rust/kernel/auxiliary.rs   |  2 +-
 rust/kernel/cpu.rs         |  2 +-
 rust/kernel/device.rs      |  6 +++---
 rust/kernel/drm/device.rs  |  4 ++--
 rust/kernel/drm/file.rs    |  8 ++++----
 rust/kernel/drm/gem/mod.rs | 16 ++++++++--------
 rust/kernel/drm/ioctl.rs   |  4 ++--
 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 +-
 12 files changed, 26 insertions(+), 26 deletions(-)
---
base-commit: 86731a2a651e58953fc949573895f2fa6d456841
change-id: 20250709-device-as-ref-350db5317dd1

Best regards,
-- 
Alice Ryhl <aliceryhl@google.com>


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-07-16 22:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-11  8:04 [PATCH v2 0/2] Rename Device::as_ref() to from_raw() Alice Ryhl
2025-07-11  8:04 ` [PATCH v2 1/2] device: rust: rename Device::as_ref() to Device::from_raw() Alice Ryhl
2025-07-11  9:11   ` Benno Lossin
2025-07-14 13:20   ` Danilo Krummrich
2025-07-16  9:16   ` Greg Kroah-Hartman
2025-07-16 22:57   ` Danilo Krummrich
2025-07-11  8:04 ` [PATCH v2 2/2] drm: rust: rename as_ref() to from_raw() for drm constructors Alice Ryhl
2025-07-11  9:11   ` Benno Lossin
2025-07-11 14:34   ` Danilo Krummrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).