linux-kernelorg-stable/drivers/cpufreq
Viresh Kumar 33db8c97b4 rust: Use CpuId in place of raw CPU numbers
Use the newly defined `CpuId` abstraction instead of raw CPU numbers.

This also fixes a doctest failure for configurations where `nr_cpu_ids <
4`.

The C `cpumask_{set|clear}_cpu()` APIs emit a warning when given an
invalid CPU number — but only if `CONFIG_DEBUG_PER_CPU_MAPS=y` is set.

Meanwhile, `cpumask_weight()` only considers CPUs up to `nr_cpu_ids`,
which can cause inconsistencies: a CPU number greater than `nr_cpu_ids`
may be set in the mask, yet the weight calculation won't reflect it.

This leads to doctest failures when `nr_cpu_ids < 4`, as the test tries
to set CPUs 2 and 3:

  rust_doctest_kernel_cpumask_rs_0.location: rust/kernel/cpumask.rs:180
  rust_doctest_kernel_cpumask_rs_0: ASSERTION FAILED at rust/kernel/cpumask.rs:190

Fixes: 8961b8cb30 ("rust: cpumask: Add initial abstractions")
Reported-by: Miguel Ojeda <ojeda@kernel.org>
Closes: https://lore.kernel.org/rust-for-linux/CANiq72k3ozKkLMinTLQwvkyg9K=BeRxs1oYZSKhJHY-veEyZdg@mail.gmail.com/
Reported-by: Andreas Hindborg <a.hindborg@kernel.org>
Closes: https://lore.kernel.org/all/87qzzy3ric.fsf@kernel.org/
Suggested-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
2025-06-12 10:31:28 +05:30
..
Kconfig cpufreq: Add Rust-based cpufreq-dt driver 2025-05-20 11:21:11 +05:30
Kconfig.arm cpufreq: fix compile-test defaults 2025-04-17 13:36:29 +05:30
Kconfig.powerpc
Kconfig.x86
Makefile cpufreq: Add Rust-based cpufreq-dt driver 2025-05-20 11:21:11 +05:30
acpi-cpufreq.c Merge branch 'pm-cpufreq' 2025-05-30 20:11:09 +02:00
airoha-cpufreq.c
amd-pstate-trace.c
amd-pstate-trace.h
amd-pstate-ut.c Power management updates for 6.16-rc1 2025-05-27 16:48:47 -07:00
amd-pstate.c Power management updates for 6.16-rc1 2025-05-27 16:48:47 -07:00
amd-pstate.h amd-pstate-ut: Reset amd-pstate driver mode after running selftests 2025-05-05 12:07:42 -05:00
amd_freq_sensitivity.c x86/msr: Rename 'rdmsrl_safe()' to 'rdmsrq_safe()' 2025-04-10 11:58:38 +02:00
apple-soc-cpufreq.c cpufreq: apple-soc: Fix null-ptr-deref in apple_soc_cpufreq_get_rate() 2025-04-10 10:07:32 +05:30
armada-8k-cpufreq.c cpufreq: Init cpufreq only for present CPUs 2025-03-17 11:29:18 +05:30
armada-37xx-cpufreq.c
bmips-cpufreq.c
brcmstb-avs-cpufreq.c
cppc_cpufreq.c cpufreq: CPPC: Add support for autonomous selection 2025-05-21 22:47:44 +02:00
cpufreq-dt-platdev.c cpufreq: Add SM8650 to cpufreq-dt-platdev blocklist 2025-04-08 11:36:32 +05:30
cpufreq-dt.c cpufreq: Init cpufreq only for present CPUs 2025-03-17 11:29:18 +05:30
cpufreq-dt.h
cpufreq-nforce2.c
cpufreq.c cpufreq: Update sscanf() to kstrtouint() 2025-05-21 22:27:36 +02:00
cpufreq_conservative.c
cpufreq_governor.c
cpufreq_governor.h
cpufreq_governor_attr_set.c
cpufreq_ondemand.c cpufreq: Fix setting policy limits when frequency tables are used 2025-04-28 14:36:41 +02:00
cpufreq_ondemand.h
cpufreq_performance.c
cpufreq_powersave.c
cpufreq_stats.c
cpufreq_userspace.c
davinci-cpufreq.c
e_powersaver.c x86/msr: Rename 'wrmsrl()' to 'wrmsrq()' 2025-04-10 11:58:33 +02:00
elanfreq.c x86/msr: Add explicit includes of <asm/msr.h> 2025-05-02 10:23:47 +02:00
freq_table.c cpufreq: Fix setting policy limits when frequency tables are used 2025-04-28 14:36:41 +02:00
gx-suspmod.c
highbank-cpufreq.c
imx-cpufreq-dt.c
imx6q-cpufreq.c
intel_pstate.c Power management updates for 6.16-rc1 2025-05-27 16:48:47 -07:00
kirkwood-cpufreq.c
longhaul.c x86/msr: Rename 'wrmsrl()' to 'wrmsrq()' 2025-04-10 11:58:33 +02:00
longhaul.h
longrun.c
loongson2_cpufreq.c
loongson3_cpufreq.c
mediatek-cpufreq-hw.c cpufreq: Init cpufreq only for present CPUs 2025-03-17 11:29:18 +05:30
mediatek-cpufreq.c cpufreq: Init cpufreq only for present CPUs 2025-03-17 11:29:18 +05:30
mvebu-cpufreq.c cpufreq: Init cpufreq only for present CPUs 2025-03-17 11:29:18 +05:30
omap-cpufreq.c
p4-clockmod.c
pasemi-cpufreq.c
pcc-cpufreq.c
pmac32-cpufreq.c
pmac64-cpufreq.c
powernow-k6.c
powernow-k7.c x86/msr: Rename 'wrmsrl()' to 'wrmsrq()' 2025-04-10 11:58:33 +02:00
powernow-k7.h
powernow-k8.c powernow: use pr_info_once 2025-05-11 17:54:05 -07:00
powernow-k8.h
powernv-cpufreq.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
pxa2xx-cpufreq.c
pxa3xx-cpufreq.c
qcom-cpufreq-hw.c cpufreq: Init cpufreq only for present CPUs 2025-03-17 11:29:18 +05:30
qcom-cpufreq-nvmem.c cpufreq: Init cpufreq only for present CPUs 2025-03-17 11:29:18 +05:30
qoriq-cpufreq.c
raspberrypi-cpufreq.c
rcpufreq_dt.rs rust: Use CpuId in place of raw CPU numbers 2025-06-12 10:31:28 +05:30
s3c64xx-cpufreq.c
s5pv210-cpufreq.c
sa1110-cpufreq.c
sc520_freq.c x86/msr: Add explicit includes of <asm/msr.h> 2025-05-02 10:23:47 +02:00
scmi-cpufreq.c cpufreq: scmi: Skip SCMI devices that aren't used by the CPUs 2025-05-20 11:24:18 +05:30
scpi-cpufreq.c cpufreq: scpi: Fix null-ptr-deref in scpi_cpufreq_get_rate() 2025-04-10 10:09:03 +05:30
sh-cpufreq.c
sparc-us2e-cpufreq.c
sparc-us3-cpufreq.c
spear-cpufreq.c
speedstep-centrino.c
speedstep-ich.c
speedstep-lib.c
speedstep-lib.h
speedstep-smi.c
sti-cpufreq.c
sun50i-cpufreq-nvmem.c cpufreq: sun50i: prevent out-of-bounds access 2025-04-08 11:35:30 +05:30
tegra20-cpufreq.c
tegra124-cpufreq.c
tegra186-cpufreq.c cpufreq: tegra186: Share policy per cluster 2025-03-10 11:20:05 +05:30
tegra194-cpufreq.c
ti-cpufreq.c
vexpress-spc-cpufreq.c
virtual-cpufreq.c cpufreq: Init cpufreq only for present CPUs 2025-03-17 11:29:18 +05:30