[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2025010855-cargo-quickness-a08f@gregkh>
Date: Wed, 8 Jan 2025 12:50:31 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: Viresh Kumar <viresh.kumar@...aro.org>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>,
Miguel Ojeda <miguel.ojeda.sandonis@...il.com>,
Danilo Krummrich <dakr@...hat.com>, Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
linux-pm@...r.kernel.org,
Vincent Guittot <vincent.guittot@...aro.org>,
Stephen Boyd <sboyd@...nel.org>, Nishanth Menon <nm@...com>,
rust-for-linux@...r.kernel.org,
Manos Pitsidianakis <manos.pitsidianakis@...aro.org>,
Erik Schilling <erik.schilling@...aro.org>,
Alex Bennée <alex.bennee@...aro.org>,
Joakim Bech <joakim.bech@...aro.org>, Rob Herring <robh@...nel.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH V6 02/15] cpufreq: Add cpufreq_table_len()
On Wed, Jan 08, 2025 at 04:42:53PM +0530, Viresh Kumar wrote:
> On 07-01-25, 12:59, Greg KH wrote:
> > On Tue, Jan 07, 2025 at 04:51:35PM +0530, Viresh Kumar wrote:
> > > Add a function to calculate number of entries in the cpufreq table. This
> > > will be used by the Rust implementation.
> >
> > Again, why is Rust unique here? Why wouldn't the C code also need this?
>
> How about this:
>
> cpufreq: Add cpufreq_table_len()
>
> The last entry of a cpufreq table is marked by setting the frequency
> field to a special value: CPUFREQ_TABLE_END. The C code manages to
> traverse the table by checking the frequency field, until it reaches
> CPUFREQ_TABLE_END.
>
> The Rust cpufreq bindings though will need to know the length of the
> cpufreq table in advance, for example to check against an invalid index
> value.
>
> Provide a helper to calculate number of entries in the cpufreq table.
> will be used by the Rust implementation.
Odd, why can't Rust also know where CPUFREQ_TABLE_END is? Why do you
have to do extra work here? That feels wrong.
thanks,
greg k-h
Powered by blists - more mailing lists