[PATCH v2] rust: device_id: replace incorrect word in safety documentation

Yilin Chen posted 1 patch 1 month, 1 week ago
rust/kernel/device_id.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH v2] rust: device_id: replace incorrect word in safety documentation
Posted by Yilin Chen 1 month, 1 week ago
The safety documentation incorrectly refers to `RawDeviceId` when
transmuting to `RawType`. This fixes the documentation to correctly
indicate that implementers must ensure layout compatibility with
`RawType`, not `RawDeviceId`.

Signed-off-by: Yilin Chen <1479826151@qq.com>
---
Changes in v2:
- Changed subject (Kari Argillander)
- Use real name in signed-off-by line (Kari Argillander)
- Link to v1: https://lore.kernel.org/rust-for-linux/tencent_9F74630DC16B92484463BBC055DEB1F17306@qq.com/
---
 rust/kernel/device_id.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rust/kernel/device_id.rs b/rust/kernel/device_id.rs
index 62c42da12e9d..8e9721446014 100644
--- a/rust/kernel/device_id.rs
+++ b/rust/kernel/device_id.rs
@@ -15,7 +15,7 @@
 /// # Safety
 ///
 /// Implementers must ensure that `Self` is layout-compatible with [`RawDeviceId::RawType`];
-/// i.e. it's safe to transmute to `RawDeviceId`.
+/// i.e. it's safe to transmute to `RawType`.
 ///
 /// This requirement is needed so `IdArray::new` can convert `Self` to `RawType` when building
 /// the ID table.
-- 
2.34.1
Re: [PATCH v2] rust: device_id: replace incorrect word in safety documentation
Posted by Danilo Krummrich 1 month, 1 week ago
On Sun Dec 28, 2025 at 5:53 PM CET, Yilin Chen wrote:
> The safety documentation incorrectly refers to `RawDeviceId` when
> transmuting to `RawType`. This fixes the documentation to correctly
> indicate that implementers must ensure layout compatibility with
> `RawType`, not `RawDeviceId`.
>

Fixes: 9b90864bb42b ("rust: implement `IdArray`, `IdTable` and `RawDeviceId`")

> Signed-off-by: Yilin Chen <1479826151@qq.com>

Applied to driver-core-linus, thanks!