Re: [PATCH V8 00/14] Rust bindings for cpufreq and OPP core + sample driver
From: Viresh Kumar
Date: Mon Feb 17 2025 - 05:25:05 EST
On 17-02-25, 09:39, Miguel Ojeda wrote:
> Ah, I see now -- yeah, this is due to:
>
> https://blog.rust-lang.org/2024/10/17/Rust-1.82.0.html#safely-addressing-unsafe-statics
>
> You could do (probably with a comment):
>
> pub fn new(name: &'static CStr, data: T::Data, flags: u16,
> boost: bool) -> Result<Self> {
> + #![allow(unused_unsafe)]
> +
> let mut drv = KBox::new(
>
> Yeah, a bit annoying... :(
+ // Required due to Rust 1.82's stricter handling of `unsafe` in mutable statics. The
+ // `unsafe` blocks aren't required anymore with later versions.
+ #![allow(unused_unsafe)]
> diff --git a/rust/kernel/cpufreq.rs b/rust/kernel/cpufreq.rs
> index d2e7913e170b..e7c62770fc3b 100644
> --- a/rust/kernel/cpufreq.rs
> +++ b/rust/kernel/cpufreq.rs
> + attr[next] =
> + // SAFETY: ...
Ah, I wasn't sure if adding a SAFETY comment after `=` is fine.
Thanks.
--
viresh