Re: [PATCH v3] rust: cpufreq: Ensure C ABI compatibility in all unsafe

From: Miguel Ojeda
Date: Thu Jun 19 2025 - 03:32:32 EST


On Thu, Jun 19, 2025 at 8:57 AM Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
>
> I think the one in prelude points to core::ffi::* instead, while we
> want to use kernel::ffi::* ?
>
> Miguel ?

The one in the `kernel` prelude points to the kernel ones (the core
ones should not be used anymore).

> Also why does prelude use ::ffi::* instead of kernel::ffi::* ? I was always a
> bit confused about it.

It is because we define them in a crate called `ffi`, not in the
`kernel` one; and we also re-export it in `kernel`.

In any case, from now on, one should just refer to them directly as
`c_*` (please use the `kernel` prelude for that) -- please see:

https://docs.kernel.org/rust/coding-guidelines.html#c-ffi-types

I hope that helps!

Cheers,
Miguel