From: "Benno Lossin" <lossin@kernel.org>
To: "Abhinav Ananthu" <abhinav.ogl@gmail.com>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>
Cc: "Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
rust-for-linux@vger.kernel.org
Subject: Re: [PATCH] cpufreq: rust: Use C FFI types in bios_limit_callback
Date: Thu, 12 Jun 2025 09:43:42 +0200 [thread overview]
Message-ID: <DAKDXCX8JJVP.2MG7OCAEY73MR@kernel.org> (raw)
In-Reply-To: <20250612060929.28773-1-abhinav.ogl@gmail.com>
On Thu Jun 12, 2025 at 8:09 AM CEST, Abhinav Ananthu wrote:
> Update the bios_limit_callback function to use C FFI-compatible types
> (kernel::ffi::c_int and kernel::ffi::c_uint) for its parameters and return
> value. This ensures ABI compatibility with the corresponding C callback
> signature.
>
> Reported-by: Miguel Ojeda <ojeda@kernel.org>
> Closes: https://lore.kernel.org/rust-for-linux/CANiq72=WpuGELzLbH-fxdOeJy9fiDFwatz6ynERDh=HP2z2MBw@mail.gmail.com/.
> Signed-off-by: Abhinav Ananthu <abhinav.ogl@gmail.com>
> ---
> rust/kernel/cpufreq.rs | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/rust/kernel/cpufreq.rs b/rust/kernel/cpufreq.rs
> index b0a9c6182aec..7ef2f64d8f34 100644
> --- a/rust/kernel/cpufreq.rs
> +++ b/rust/kernel/cpufreq.rs
> @@ -1277,7 +1277,7 @@ extern "C" fn update_limits_callback(ptr: *mut bindings::cpufreq_policy) {
> /// Driver's `bios_limit` callback.
> ///
> /// SAFETY: Called from C. Inputs must be valid pointers.
> - extern "C" fn bios_limit_callback(cpu: i32, limit: *mut u32) -> kernel::ffi::c_int {
> + extern "C" fn bios_limit_callback(cpu: kernel::ffi::c_int, limit: *mut kernel::ffi::c_uint) -> kernel::ffi::c_int {
This file imports the kernel's prelude, so you should be able to just
use `c_int` and `c_uint` instead of their qualified names.
---
Cheers,
Benno
> from_result(|| {
> let mut policy = PolicyCpu::from_cpu(cpu as u32)?;
>
next prev parent reply other threads:[~2025-06-12 7:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-12 6:09 [PATCH] cpufreq: rust: Use C FFI types in bios_limit_callback Abhinav Ananthu
2025-06-12 7:43 ` Benno Lossin [this message]
2025-06-12 8:46 ` [PATCHv2 rust-for-linux] fix : Update the bios_limit_callback to use Abhinav Ananthu
2025-06-12 9:38 ` Miguel Ojeda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DAKDXCX8JJVP.2MG7OCAEY73MR@kernel.org \
--to=lossin@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=abhinav.ogl@gmail.com \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=gary@garyguo.net \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.