Commit b78030d0 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

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
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -1476,13 +1476,13 @@ static void __intel_pstate_update_max_freq(struct cpufreq_policy *policy,
	refresh_frequency_limits(policy);
}

static bool intel_pstate_update_max_freq(struct cpudata *cpudata)
static bool intel_pstate_update_max_freq(int cpu)
{
	struct cpufreq_policy *policy __free(put_cpufreq_policy) = cpufreq_cpu_get(cpudata->cpu);
	struct cpufreq_policy *policy __free(put_cpufreq_policy) = cpufreq_cpu_get(cpu);
	if (!policy)
		return false;

	__intel_pstate_update_max_freq(policy, cpudata);
	__intel_pstate_update_max_freq(policy, all_cpu_data[cpu]);

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

	for_each_possible_cpu(cpu)
		intel_pstate_update_max_freq(all_cpu_data[cpu]);
		intel_pstate_update_max_freq(cpu);

	mutex_lock(&hybrid_capacity_lock);

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

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

	freq = cpudata->pstate.turbo_freq;

	if (type == FREQ_QOS_MIN) {
		freq = DIV_ROUND_UP(freq * global.min_perf_pct, 100);
	} else {
@@ -1908,7 +1910,7 @@ static void intel_pstate_notify_work(struct work_struct *work)
	struct cpudata *cpudata =
		container_of(to_delayed_work(work), struct cpudata, hwp_notify_work);

	if (intel_pstate_update_max_freq(cpudata)) {
	if (intel_pstate_update_max_freq(cpudata->cpu)) {
		/*
		 * The driver will not be unregistered while this function is
		 * running, so update the capacity without acquiring the driver
+3 −1
Original line number Diff line number Diff line
@@ -1416,7 +1416,9 @@ static int imx_pgc_domain_suspend(struct device *dev)

static int imx_pgc_domain_resume(struct device *dev)
{
	return pm_runtime_put(dev);
	pm_runtime_put(dev);

	return 0;
}
#endif

+2 −14
Original line number Diff line number Diff line
@@ -545,22 +545,10 @@ static inline int pm_runtime_resume_and_get(struct device *dev)
 *
 * Decrement the runtime PM usage counter of @dev and if it turns out to be
 * equal to 0, queue up a work item for @dev like in pm_request_idle().
 *
 * Return:
 * * 1: Success. Usage counter dropped to zero, but device was already suspended.
 * * 0: Success.
 * * -EINVAL: Runtime PM error.
 * * -EACCES: Runtime PM disabled.
 * * -EAGAIN: Runtime PM usage counter became non-zero or Runtime PM status
 *            change ongoing.
 * * -EBUSY: Runtime PM child_count non-zero.
 * * -EPERM: Device PM QoS resume latency 0.
 * * -EINPROGRESS: Suspend already in progress.
 * * -ENOSYS: CONFIG_PM not enabled.
 */
static inline int pm_runtime_put(struct device *dev)
static inline void pm_runtime_put(struct device *dev)
{
	return __pm_runtime_idle(dev, RPM_GET_PUT | RPM_ASYNC);
	__pm_runtime_idle(dev, RPM_GET_PUT | RPM_ASYNC);
}

/**