Skip to content

Commit b78030d

Browse files
committed
Merge branches 'pm-cpufreq' and 'pm-runtime'
Merge cpufreq and runtime PM updates for 7.0-rc2: - Fix two issues in the intel_pstate driver causing it to crash when its sysfs interface is used on a system with some offline CPUs (David Arcari, Srinivas Pandruvada) - Update the last user of the pm_runtime_put() return value to discard it and turn pm_runtime_put() into a void function (Rafael Wysocki) * pm-cpufreq: cpufreq: intel_pstate: Fix crash during turbo disable cpufreq: intel_pstate: Fix NULL pointer dereference in update_cpu_qos_request() * pm-runtime: PM: runtime: Change pm_runtime_put() return type to void pmdomain: imx: gpcv2: Discard pm_runtime_put() return value
3 parents 3ea2067 + 6b05048 + 3afd8df commit b78030d

3 files changed

Lines changed: 13 additions & 21 deletions

File tree

drivers/cpufreq/intel_pstate.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,13 +1476,13 @@ static void __intel_pstate_update_max_freq(struct cpufreq_policy *policy,
14761476
refresh_frequency_limits(policy);
14771477
}
14781478

1479-
static bool intel_pstate_update_max_freq(struct cpudata *cpudata)
1479+
static bool intel_pstate_update_max_freq(int cpu)
14801480
{
1481-
struct cpufreq_policy *policy __free(put_cpufreq_policy) = cpufreq_cpu_get(cpudata->cpu);
1481+
struct cpufreq_policy *policy __free(put_cpufreq_policy) = cpufreq_cpu_get(cpu);
14821482
if (!policy)
14831483
return false;
14841484

1485-
__intel_pstate_update_max_freq(policy, cpudata);
1485+
__intel_pstate_update_max_freq(policy, all_cpu_data[cpu]);
14861486

14871487
return true;
14881488
}
@@ -1501,7 +1501,7 @@ static void intel_pstate_update_limits_for_all(void)
15011501
int cpu;
15021502

15031503
for_each_possible_cpu(cpu)
1504-
intel_pstate_update_max_freq(all_cpu_data[cpu]);
1504+
intel_pstate_update_max_freq(cpu);
15051505

15061506
mutex_lock(&hybrid_capacity_lock);
15071507

@@ -1647,8 +1647,8 @@ static ssize_t store_no_turbo(struct kobject *a, struct kobj_attribute *b,
16471647
static void update_cpu_qos_request(int cpu, enum freq_qos_req_type type)
16481648
{
16491649
struct cpudata *cpudata = all_cpu_data[cpu];
1650-
unsigned int freq = cpudata->pstate.turbo_freq;
16511650
struct freq_qos_request *req;
1651+
unsigned int freq;
16521652

16531653
struct cpufreq_policy *policy __free(put_cpufreq_policy) = cpufreq_cpu_get(cpu);
16541654
if (!policy)
@@ -1661,6 +1661,8 @@ static void update_cpu_qos_request(int cpu, enum freq_qos_req_type type)
16611661
if (hwp_active)
16621662
intel_pstate_get_hwp_cap(cpudata);
16631663

1664+
freq = cpudata->pstate.turbo_freq;
1665+
16641666
if (type == FREQ_QOS_MIN) {
16651667
freq = DIV_ROUND_UP(freq * global.min_perf_pct, 100);
16661668
} else {
@@ -1908,7 +1910,7 @@ static void intel_pstate_notify_work(struct work_struct *work)
19081910
struct cpudata *cpudata =
19091911
container_of(to_delayed_work(work), struct cpudata, hwp_notify_work);
19101912

1911-
if (intel_pstate_update_max_freq(cpudata)) {
1913+
if (intel_pstate_update_max_freq(cpudata->cpu)) {
19121914
/*
19131915
* The driver will not be unregistered while this function is
19141916
* running, so update the capacity without acquiring the driver

drivers/pmdomain/imx/gpcv2.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1416,7 +1416,9 @@ static int imx_pgc_domain_suspend(struct device *dev)
14161416

14171417
static int imx_pgc_domain_resume(struct device *dev)
14181418
{
1419-
return pm_runtime_put(dev);
1419+
pm_runtime_put(dev);
1420+
1421+
return 0;
14201422
}
14211423
#endif
14221424

include/linux/pm_runtime.h

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -545,22 +545,10 @@ static inline int pm_runtime_resume_and_get(struct device *dev)
545545
*
546546
* Decrement the runtime PM usage counter of @dev and if it turns out to be
547547
* equal to 0, queue up a work item for @dev like in pm_request_idle().
548-
*
549-
* Return:
550-
* * 1: Success. Usage counter dropped to zero, but device was already suspended.
551-
* * 0: Success.
552-
* * -EINVAL: Runtime PM error.
553-
* * -EACCES: Runtime PM disabled.
554-
* * -EAGAIN: Runtime PM usage counter became non-zero or Runtime PM status
555-
* change ongoing.
556-
* * -EBUSY: Runtime PM child_count non-zero.
557-
* * -EPERM: Device PM QoS resume latency 0.
558-
* * -EINPROGRESS: Suspend already in progress.
559-
* * -ENOSYS: CONFIG_PM not enabled.
560548
*/
561-
static inline int pm_runtime_put(struct device *dev)
549+
static inline void pm_runtime_put(struct device *dev)
562550
{
563-
return __pm_runtime_idle(dev, RPM_GET_PUT | RPM_ASYNC);
551+
__pm_runtime_idle(dev, RPM_GET_PUT | RPM_ASYNC);
564552
}
565553

566554
/**

0 commit comments

Comments
 (0)