[PATCH v1] cpufreq: Drop unused cpufreq_get_policy()

Rafael J. Wysocki posted 1 patch 10 months ago
drivers/cpufreq/cpufreq.c |   25 -------------------------
include/linux/cpufreq.h   |    1 -
2 files changed, 26 deletions(-)
[PATCH v1] cpufreq: Drop unused cpufreq_get_policy()
Posted by Rafael J. Wysocki 10 months ago
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

A recent change has introduced a bug into cpufreq_get_policy(), but this
function is not used, so it's better to drop it altogether.

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/cpufreq/cpufreq.c |   25 -------------------------
 include/linux/cpufreq.h   |    1 -
 2 files changed, 26 deletions(-)

--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2549,31 +2549,6 @@
  *                          POLICY INTERFACE                         *
  *********************************************************************/
 
-/**
- * cpufreq_get_policy - get the current cpufreq_policy
- * @policy: struct cpufreq_policy into which the current cpufreq_policy
- *	is written
- * @cpu: CPU to find the policy for
- *
- * Reads the current cpufreq policy.
- */
-int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu)
-{
-	struct cpufreq_policy *cpu_policy __free(put_cpufreq_policy);
-
-	if (!policy)
-		return -EINVAL;
-
-	cpu_policy = cpufreq_cpu_get(cpu);
-	if (!cpu_policy)
-		return -EINVAL;
-
-	memcpy(policy, cpu_policy, sizeof(*policy));
-
-	return 0;
-}
-EXPORT_SYMBOL(cpufreq_get_policy);
-
 DEFINE_PER_CPU(unsigned long, cpufreq_pressure);
 
 /**
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -241,7 +241,6 @@
 
 u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy);
 
-int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);
 void refresh_frequency_limits(struct cpufreq_policy *policy);
 void cpufreq_update_policy(unsigned int cpu);
 void cpufreq_update_limits(unsigned int cpu);
Re: [PATCH v1] cpufreq: Drop unused cpufreq_get_policy()
Posted by Sudeep Holla 10 months ago
On Thu, Apr 10, 2025 at 12:20:43PM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> A recent change has introduced a bug into cpufreq_get_policy(), but this
> function is not used, so it's better to drop it altogether.
> 

Acked-by: Sudeep Holla <sudeep.holla@arm.com>

-- 
Regards,
Sudeep
Re: [PATCH v1] cpufreq: Drop unused cpufreq_get_policy()
Posted by Viresh Kumar 10 months ago
On 10-04-25, 12:20, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> A recent change has introduced a bug into cpufreq_get_policy(), but this
> function is not used, so it's better to drop it altogether.
> 
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>  drivers/cpufreq/cpufreq.c |   25 -------------------------
>  include/linux/cpufreq.h   |    1 -
>  2 files changed, 26 deletions(-)

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh