@@ -1530,7 +1530,7 @@ static void amd_pstate_epp_offline(struct cpufreq_policy *policy)
mutex_unlock(&amd_pstate_limits_lock);
}
-static int amd_pstate_epp_cpu_offline(struct cpufreq_policy *policy)
+static void amd_pstate_epp_cpu_offline(struct cpufreq_policy *policy)
{
struct amd_cpudata *cpudata = policy->driver_data;
@@ -1541,8 +1541,6 @@ static int amd_pstate_epp_cpu_offline(struct cpufreq_policy *policy)
if (cppc_state == AMD_PSTATE_ACTIVE)
amd_pstate_epp_offline(policy);
-
- return 0;
}
static int amd_pstate_epp_verify_policy(struct cpufreq_policy_data *policy)
@@ -1685,7 +1685,7 @@ static void __cpufreq_offline(unsigned int cpu, struct cpufreq_policy *policy)
}
}
-static int cpufreq_offline(unsigned int cpu)
+static void cpufreq_offline(unsigned int cpu)
{
struct cpufreq_policy *policy;
@@ -1702,7 +1702,6 @@ static int cpufreq_offline(unsigned int cpu)
__cpufreq_offline(cpu, policy);
up_write(&policy->rwsem);
- return 0;
}
/*
@@ -2679,14 +2679,14 @@ static int intel_pstate_verify_policy(struct cpufreq_policy_data *policy)
return 0;
}
-static int intel_cpufreq_cpu_offline(struct cpufreq_policy *policy)
+static void intel_cpufreq_cpu_offline(struct cpufreq_policy *policy)
{
struct cpudata *cpu = all_cpu_data[policy->cpu];
pr_debug("CPU %d going offline\n", cpu->cpu);
if (cpu->suspended)
- return 0;
+ return;
/*
* If the CPU is an SMT thread and it goes offline with the performance
@@ -2700,8 +2700,6 @@ static int intel_cpufreq_cpu_offline(struct cpufreq_policy *policy)
intel_pstate_set_min_pstate(cpu);
intel_pstate_exit_perf_limits(policy);
-
- return 0;
}
static int intel_pstate_cpu_online(struct cpufreq_policy *policy)
@@ -2724,11 +2722,11 @@ static int intel_pstate_cpu_online(struct cpufreq_policy *policy)
return 0;
}
-static int intel_pstate_cpu_offline(struct cpufreq_policy *policy)
+static void intel_pstate_cpu_offline(struct cpufreq_policy *policy)
{
intel_pstate_clear_update_util_hook(policy->cpu);
- return intel_cpufreq_cpu_offline(policy);
+ intel_cpufreq_cpu_offline(policy);
}
static int intel_pstate_cpu_exit(struct cpufreq_policy *policy)
@@ -482,12 +482,12 @@ static int qcom_cpufreq_hw_cpu_online(struct cpufreq_policy *policy)
return ret;
}
-static int qcom_cpufreq_hw_cpu_offline(struct cpufreq_policy *policy)
+static void qcom_cpufreq_hw_cpu_offline(struct cpufreq_policy *policy)
{
struct qcom_cpufreq_data *data = policy->driver_data;
if (data->throttle_irq <= 0)
- return 0;
+ return;
mutex_lock(&data->throttle_lock);
data->cancel_throttle = true;
@@ -496,8 +496,6 @@ static int qcom_cpufreq_hw_cpu_offline(struct cpufreq_policy *policy)
cancel_delayed_work_sync(&data->throttle_work);
irq_set_affinity_and_hint(data->throttle_irq, NULL);
disable_irq_nosync(data->throttle_irq);
-
- return 0;
}
static void qcom_cpufreq_hw_lmh_exit(struct qcom_cpufreq_data *data)
@@ -541,16 +541,6 @@ static int tegra194_cpufreq_online(struct cpufreq_policy *policy)
return 0;
}
-static int tegra194_cpufreq_offline(struct cpufreq_policy *policy)
-{
- /*
- * Preserve policy->driver_data and don't free resources on light-weight
- * tear down.
- */
-
- return 0;
-}
-
static int tegra194_cpufreq_exit(struct cpufreq_policy *policy)
{
struct device *cpu_dev = get_cpu_device(policy->cpu);
@@ -590,7 +580,6 @@ static struct cpufreq_driver tegra194_cpufreq_driver = {
.init = tegra194_cpufreq_init,
.exit = tegra194_cpufreq_exit,
.online = tegra194_cpufreq_online,
- .offline = tegra194_cpufreq_offline,
.attr = cpufreq_generic_attr,
};
@@ -385,7 +385,7 @@ struct cpufreq_driver {
int (*bios_limit)(int cpu, unsigned int *limit);
int (*online)(struct cpufreq_policy *policy);
- int (*offline)(struct cpufreq_policy *policy);
+ void (*offline)(struct cpufreq_policy *policy);
int (*exit)(struct cpufreq_policy *policy);
int (*suspend)(struct cpufreq_policy *policy);
int (*resume)(struct cpufreq_policy *policy);
For the offline() callback function returning an int type value, this leads many driver authors mistakenly believing that error handling can be performed by returning an error code, However the returned value is ignored, and to improve this situation, it is proposed to modify the return type of the offline() callback function to void. Signed-off-by: Lizhe <sensor1010@163.com> --- drivers/cpufreq/amd-pstate.c | 4 +--- drivers/cpufreq/cpufreq.c | 3 +-- drivers/cpufreq/intel_pstate.c | 10 ++++------ drivers/cpufreq/qcom-cpufreq-hw.c | 6 ++---- drivers/cpufreq/tegra194-cpufreq.c | 11 ----------- include/linux/cpufreq.h | 2 +- 6 files changed, 9 insertions(+), 27 deletions(-)