Commit 9314a0e9 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'pm-5.12-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management fixes from Rafael Wysocki:
 "These fix a race condition and an ordering issue related to using
  device links in the runtime PM framework and two kerneldoc comments in
  cpufreq.

  Specifics:

   - Fix race condition related to the handling of supplier devices
     during consumer device probe and fix the order of decrementation of
     two related reference counters in the runtime PM core code handling
     supplier devices (Adrian Hunter).

   - Fix kerneldoc comments in cpufreq that have not been updated along
     with the functions documented by them (Geert Uytterhoeven)"

* tag 'pm-5.12-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  PM: runtime: Fix race getting/putting suppliers at probe
  PM: runtime: Fix ordering in pm_runtime_get_suppliers()
  cpufreq: Fix scaling_{available,boost}_frequencies_show() comments
parents 05de4538 ac1790ad
...@@ -1690,8 +1690,8 @@ void pm_runtime_get_suppliers(struct device *dev) ...@@ -1690,8 +1690,8 @@ void pm_runtime_get_suppliers(struct device *dev)
device_links_read_lock_held()) device_links_read_lock_held())
if (link->flags & DL_FLAG_PM_RUNTIME) { if (link->flags & DL_FLAG_PM_RUNTIME) {
link->supplier_preactivated = true; link->supplier_preactivated = true;
refcount_inc(&link->rpm_active);
pm_runtime_get_sync(link->supplier); pm_runtime_get_sync(link->supplier);
refcount_inc(&link->rpm_active);
} }
device_links_read_unlock(idx); device_links_read_unlock(idx);
...@@ -1704,6 +1704,8 @@ void pm_runtime_get_suppliers(struct device *dev) ...@@ -1704,6 +1704,8 @@ void pm_runtime_get_suppliers(struct device *dev)
void pm_runtime_put_suppliers(struct device *dev) void pm_runtime_put_suppliers(struct device *dev)
{ {
struct device_link *link; struct device_link *link;
unsigned long flags;
bool put;
int idx; int idx;
idx = device_links_read_lock(); idx = device_links_read_lock();
...@@ -1712,7 +1714,11 @@ void pm_runtime_put_suppliers(struct device *dev) ...@@ -1712,7 +1714,11 @@ void pm_runtime_put_suppliers(struct device *dev)
device_links_read_lock_held()) device_links_read_lock_held())
if (link->supplier_preactivated) { if (link->supplier_preactivated) {
link->supplier_preactivated = false; link->supplier_preactivated = false;
if (refcount_dec_not_one(&link->rpm_active)) spin_lock_irqsave(&dev->power.lock, flags);
put = pm_runtime_status_suspended(dev) &&
refcount_dec_not_one(&link->rpm_active);
spin_unlock_irqrestore(&dev->power.lock, flags);
if (put)
pm_runtime_put(link->supplier); pm_runtime_put(link->supplier);
} }
......
...@@ -267,7 +267,7 @@ struct freq_attr cpufreq_freq_attr_##_name##_freqs = \ ...@@ -267,7 +267,7 @@ struct freq_attr cpufreq_freq_attr_##_name##_freqs = \
__ATTR_RO(_name##_frequencies) __ATTR_RO(_name##_frequencies)
/* /*
* show_scaling_available_frequencies - show available normal frequencies for * scaling_available_frequencies_show - show available normal frequencies for
* the specified CPU * the specified CPU
*/ */
static ssize_t scaling_available_frequencies_show(struct cpufreq_policy *policy, static ssize_t scaling_available_frequencies_show(struct cpufreq_policy *policy,
...@@ -279,7 +279,7 @@ cpufreq_attr_available_freq(scaling_available); ...@@ -279,7 +279,7 @@ cpufreq_attr_available_freq(scaling_available);
EXPORT_SYMBOL_GPL(cpufreq_freq_attr_scaling_available_freqs); EXPORT_SYMBOL_GPL(cpufreq_freq_attr_scaling_available_freqs);
/* /*
* show_available_boost_freqs - show available boost frequencies for * scaling_boost_frequencies_show - show available boost frequencies for
* the specified CPU * the specified CPU
*/ */
static ssize_t scaling_boost_frequencies_show(struct cpufreq_policy *policy, static ssize_t scaling_boost_frequencies_show(struct cpufreq_policy *policy,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment