Re: [PATCH v2] rust: cpufreq: Add CPUFREQ_TABLE_END as last table entry in TableBuilder::to_table
Viresh Kumar <[email protected]> Tue, 28 Jul 2026 14:17:42 +0530
| Newsgroups | org.kernel.vger.rust-for-linux,org.kernel.vger.linux-pm |
|---|---|
| Message-ID | <qyjrkxlyqgn5wpfl456mdhwidouupghnaaznsisotri7bkqvl4@4xe5y46nzehh> |
On 20-07-26, 20:50, Priya Bala Govindasamy wrote:
> The `TableBuilder::to_table` function adds `Hertz(c_ulong::MAX).as_khz()`
> as the last frequency entry in the frequency table.
> But the C API expects the last entry to have frequency set to
> `CPUFREQ_TABLE_END` which is `~1u` as per include/linux/cpufreq.h.
>
> Fix this by setting the last frequency entry to `CPUFREQ_TABLE_END`
> instead of `Hertz(c_ulong::MAX).as_khz()`.
>
> Fixes: 2207856ff0bc8d953d6e89bda70b8978c2de8bab ("rust: cpufreq: Add initial abstractions for cpufreq framework")
> Reported-by: Dylan Zueck<[email protected]>
> Reported-by: Yuan Tan<[email protected]>
> Assisted-by: ChatGPT:gpt-5.6-terra
> Signed-off-by: Priya Bala Govindasamy<[email protected]>
>
> Changes in v2:
> - Create `TableBuilder::push` method to add entries to the table
> without converting the frequency to kHz.
> - `TableBuilder::add` now internally uses `TableBuilder::push` to add
> entries to the table after converting the frequency to kHz.
> - Use the new `TableBuilder::push` method to add to the last table
> entry.
> - Link to v1: https://lore.kernel.org/rust-for-linux/[email protected]/T/#t
> ---
> rust/kernel/cpufreq.rs | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
Applied. Thanks.
--
viresh