[PATCH] cpufreq: Covert to offline callback returning void

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---
 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(-)

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 2015c9fcc3c9..036608935aaa 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -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)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 66e10a19d76a..04d349372de3 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -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;
 }
 
 /*
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index dbbf299f4219..80dfe1c20210 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -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)
diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
index 70b0f21968a0..dc35fa3cc3ce 100644
--- a/drivers/cpufreq/qcom-cpufreq-hw.c
+++ b/drivers/cpufreq/qcom-cpufreq-hw.c
@@ -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)
diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c
index 59865ea455a8..8b57dcd43d54 100644
--- a/drivers/cpufreq/tegra194-cpufreq.c
+++ b/drivers/cpufreq/tegra194-cpufreq.c
@@ -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,
 };
 
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 9956afb9acc2..2472e9fd2df9 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -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);
-- 
2.25.1





[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux