History

Merge tag 'cpufreq-arm-updates-7.3' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm

Pull CPUFreq Arm updates for 7.3 from Viresh Kumar: "- Minor fixes / cleanups in cpufreq drivers (Dan Carpenter, Guru Das Srinagesh, Haoxiang Li, Karl Mehltretter, Sasha Finkelstein, and Pan Chuang). - Fix cpufreq table creation and bios_limits() callback in the Rust bindings (Priya Bala Govindasamy). - Add IPQ5210 support to qcom-nvmem driver (Varadarajan Narayanan)." * tag 'cpufreq-arm-updates-7.3' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm: cpufreq: imx6q: fix out-of-bounds write when probed more than once cpufreq: imx6q: fix devres accumulation across driver rebind rust: cpufreq: Fix temporary write in Registration::bios_limit_callback rust: cpufreq: Add CPUFREQ_TABLE_END as last table entry in TableBuilder::to_table cpufreq: apple-soc: Calculate frequency as a 64-bit value cpufreq: spear: Fix an IS_ERR() vs NULL bug in spear1340_set_cpu_rate() cpufreq: brcmstb-avs: Remove redundant dev_err() rust: rcpufreq_dt: use vertical import style cpufreq: apple-soc: Fix OPP table cleanup cpufreq: qcom-nvmem: Add IPQ5210 support

Rafael J. Wysocki committed 3 months ago

Commit f4fa4b72 parents eb49643 8c3afcf8 files · +58 −41Browse files

Showing the changes to rust/kernel (1 of 8 files). Show all

Unified · Split

rust/kernel/cpufreq.rs+17−7
@@ -361,23 +361,28 @@ impl TableBuilder { · 360 unmodified lines
361361 }
362362 }
363363
364− /// Adds a new entry to the table.
365− pub fn add(&mut self, freq: Hertz, flags: u32, driver_data: u32) -> Result {
364+ /// Adds a raw frequency-table entry.
365+ fn push(&mut self, frequency: u32, flags: u32, driver_data: u32) -> Result {
366366 // Adds the new entry at the end of the vector.
367367 Ok(self.entries.push(
368368 bindings::cpufreq_frequency_table {
369369 flags,
370370 driver_data,
371− frequency: freq.as_khz() as u32,
371+ frequency,
372372 },
373373 GFP_KERNEL,
374374 )?)
375375 }
376376
377+ /// Adds a new entry to the table.
378+ pub fn add(&mut self, freq: Hertz, flags: u32, driver_data: u32) -> Result {
379+ self.push(freq.as_khz() as u32, flags, driver_data)
380+ }
381+
377382 /// Consumes the [`TableBuilder`] and returns [`TableBox`].
378383 pub fn to_table(mut self) -> Result<TableBox> {
379384 // Add last entry to the table.
380− self.add(Hertz(c_ulong::MAX), 0, 0)?;
385+ self.push(bindings::CPUFREQ_TABLE_END as u32, 0, 0)?;
381386
382387 TableBox::new(self.entries)
383388 }
@@ -823,7 +828,9 @@ pub trait Driver { · 439 unmodified lines
823828 }
824829
825830 /// Driver's `bios_limit` callback.
826− fn bios_limit(_policy: &mut Policy, _limit: &mut u32) -> Result {
831+ ///
832+ /// Returns HW/BIOS max frequency limitations for the CPU.
833+ fn bios_limit(_policy: &mut Policy) -> Result<u32> {
827834 build_error!(VTABLE_DEFAULT_ERROR)
828835 }
829836
@@ -1359,9 +1366,12 @@ impl<T: Driver> Registration<T> { · 529 unmodified lines
13591366
13601367 from_result(|| {
13611368 let mut policy = PolicyCpu::from_cpu(cpu_id)?;
1362−
1369+ let val = T::bios_limit(&mut policy)?;
13631370 // SAFETY: `limit` is guaranteed by the C code to be valid.
1364− T::bios_limit(&mut policy, &mut (unsafe { *limit })).map(|()| 0)
1371+ unsafe {
1372+ *limit = val;
1373+ }
1374+ Ok(0)
13651375 })
13661376 }
13671377

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t