Re: [PATCH V8 00/14] Rust bindings for cpufreq and OPP core + sample driver

From: Viresh Kumar
Date: Fri Feb 07 2025 - 02:15:54 EST


Hi Danilo,

On 06-02-25, 12:45, Danilo Krummrich wrote:
> I gave it a quick shot and it seems there are a few Clippy warnings,

I could find only one (related to core::format_args), are there more ?

(Earlier I had a debug commit on top of the series in my branch and
Clippy didn't give any warnings as format_flags was getting used from
there.)

> plus rustfmtcheck complains.

I am not sure how to solve them.

Diff in rust/kernel/cpufreq.rs at line 628:

// SAFETY: The C code returns a valid pointer here, which is again passed to the C code in
// an array.
- attr[next] = unsafe {
- addr_of_mut!(bindings::cpufreq_freq_attr_scaling_available_freqs) as *mut _
- };
+ attr[next] =
+ unsafe { addr_of_mut!(bindings::cpufreq_freq_attr_scaling_available_freqs) as *mut _ };
next += 1;

if boost {

If I move the code as suggested here, then I get warning about not
adding a SAFETY comment for unsafe code (which looks to be a tool
specific bug).

I can move the entire thing into the unsafe block, but the assignment
to attr[next] isn't unsafe.

What do yo suggest here ?

> There are also two minor checkpatch complaints about line length.

Yeah, they came from the first commit (which wasn't written by me and
so I avoided touching it), fixed now.

--
viresh