mirror of
https://github.com/torvalds/linux.git
synced 2026-05-12 16:18:45 +02:00
rust: of: use core::ffi::CStr method names
Prepare for `core::ffi::CStr` taking the place of `kernel::str::CStr` by avoid methods that only exist on the latter. Link: https://github.com/Rust-for-Linux/linux/issues/1075 Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Benno Lossin <lossin@kernel.org> Signed-off-by: Tamir Duberstein <tamird@gmail.com> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
This commit is contained in:
parent
182d95571f
commit
5749cd1ed8
|
|
@ -34,7 +34,7 @@ fn index(&self) -> usize {
|
|||
impl DeviceId {
|
||||
/// Create a new device id from an OF 'compatible' string.
|
||||
pub const fn new(compatible: &'static CStr) -> Self {
|
||||
let src = compatible.as_bytes_with_nul();
|
||||
let src = compatible.to_bytes_with_nul();
|
||||
// Replace with `bindings::of_device_id::default()` once stabilized for `const`.
|
||||
// SAFETY: FFI type is valid to be zero-initialized.
|
||||
let mut of: bindings::of_device_id = unsafe { core::mem::zeroed() };
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user