Message ID | 20250413-rust_arm_fix_fw_abstaction-v3-1-8dd7c0bbcd47@gmail.com |
---|---|
State | New |
Headers | show |
Series | [v3] rust: Use `ffi::c_char` type in firmware abstraction `FwFunc` | expand |
On Sun, Apr 13, 2025 at 9:27 PM Christian Schrefl <chrisi.schrefl@gmail.com> wrote: > > The `FwFunc` struct contains an function with a char pointer argument, > for which a `*const u8` pointer was used. This is not really the > "proper" type for this, so use a `*const kernel::ffi::c_char` pointer > instead. If I don't take it: Acked-by: Miguel Ojeda <ojeda@kernel.org> Thanks! Cheers, Miguel
On Sun, Apr 13, 2025 at 09:26:56PM +0200, Christian Schrefl wrote: > The `FwFunc` struct contains an function with a char pointer argument, > for which a `*const u8` pointer was used. This is not really the > "proper" type for this, so use a `*const kernel::ffi::c_char` pointer > instead. With the following changes, applied to driver-core-linus, thanks! * add firmware prefix to commit subject - Danilo
On Sun, Apr 13, 2025 at 10:21:01PM +0200, Miguel Ojeda wrote: > On Sun, Apr 13, 2025 at 9:27 PM Christian Schrefl > <chrisi.schrefl@gmail.com> wrote: > > > > The `FwFunc` struct contains an function with a char pointer argument, > > for which a `*const u8` pointer was used. This is not really the > > "proper" type for this, so use a `*const kernel::ffi::c_char` pointer > > instead. > > If I don't take it: > > Acked-by: Miguel Ojeda <ojeda@kernel.org> Thanks, I'll take it now. greg k-h
On Tue, Apr 15, 2025 at 04:57:45PM +0200, Greg Kroah-Hartman wrote: > On Sun, Apr 13, 2025 at 10:21:01PM +0200, Miguel Ojeda wrote: > > On Sun, Apr 13, 2025 at 9:27 PM Christian Schrefl > > <chrisi.schrefl@gmail.com> wrote: > > > > > > The `FwFunc` struct contains an function with a char pointer argument, > > > for which a `*const u8` pointer was used. This is not really the > > > "proper" type for this, so use a `*const kernel::ffi::c_char` pointer > > > instead. > > > > If I don't take it: > > > > Acked-by: Miguel Ojeda <ojeda@kernel.org> > > Thanks, I'll take it now. Oops, it's already in the driver-core tree :)
diff --git a/rust/kernel/firmware.rs b/rust/kernel/firmware.rs index f04b058b09b2d2397e26344d0e055b3aa5061432..2494c96e105f3a28af74548d63a44464ba50eae3 100644 --- a/rust/kernel/firmware.rs +++ b/rust/kernel/firmware.rs @@ -4,7 +4,7 @@ //! //! C header: [`include/linux/firmware.h`](srctree/include/linux/firmware.h) -use crate::{bindings, device::Device, error::Error, error::Result, str::CStr}; +use crate::{bindings, device::Device, error::Error, error::Result, ffi, str::CStr}; use core::ptr::NonNull; /// # Invariants @@ -12,7 +12,11 @@ /// One of the following: `bindings::request_firmware`, `bindings::firmware_request_nowarn`, /// `bindings::firmware_request_platform`, `bindings::request_firmware_direct`. struct FwFunc( - unsafe extern "C" fn(*mut *const bindings::firmware, *const u8, *mut bindings::device) -> i32, + unsafe extern "C" fn( + *mut *const bindings::firmware, + *const ffi::c_char, + *mut bindings::device, + ) -> i32, ); impl FwFunc {