Re: [PATCH V6 02/15] cpufreq: Add cpufreq_table_len()
From: Greg KH
Date: Thu Jan 09 2025 - 02:36:09 EST
On Thu, Jan 09, 2025 at 10:11:17AM +0530, Viresh Kumar wrote:
> On 08-01-25, 12:50, Greg KH wrote:
> > Odd, why can't Rust also know where CPUFREQ_TABLE_END is? Why do you
> > have to do extra work here? That feels wrong.
>
> Well, it can, sure.
>
> The freq table the Rust code receives is part of the C code:
> bindings::cpufreq_frequency_table. Since it is a C managed pointer, I thought it
> is better to do the parsing in C code itself. In case the implementation of the
> struct changes in future (unlikely though), we would only need to fix the C code
> and not Rust, which looks to be the right expectation.
Then why not make the C code use this function as well, to keep all
cpufreq drivers from having to manually walk the list and that way both
C and Rust drivers all do the same thing? That makes more sense to me,
there's no reason you can't change C code today first to make things
more unified, in fact, that's usually a better idea overall anyway.
thanks,
greg k-h