Skip to contentSkip to conversation

cpufreq: Remove ready() callback

PATCH In review Viresh Kumar 2 participants 5 messages Sep 1, 2021 – Sep 2, 2021

Subsystems (3)
lore
Share & tools
lore

Viresh Kumar

author maintainer
#0 lore raw

cover cpufreq: Remove ready() callback

Remove the last few users of the ready() callback and get rid of it.

Viresh Kumar (3):
cpufreq: acpi: Remove acpi_cpufreq_cpu_ready()
cpufreq: sh: Remove sh_cpufreq_cpu_ready()
cpufreq: Remove ready() callback

 Documentation/cpu-freq/cpu-drivers.rst             |  3 ---
 .../translations/zh_CN/cpu-freq/cpu-drivers.rst    |  2 --
 drivers/cpufreq/acpi-cpufreq.c                     | 14 +++-----------
 drivers/cpufreq/cpufreq.c                          |  4 ----
 drivers/cpufreq/sh-cpufreq.c                       | 11 -----------
 include/linux/cpufreq.h                            |  3 ---
 6 files changed, 3 insertions(+), 34 deletions(-)
Signature · 1 line
2.31.1.272.g89b43f80a514
author maintainer
#1 lore raw

PATCH 1/3 cpufreq: acpi: Remove acpi_cpufreq_cpu_ready()

The ready() callback was implemented earlier for acpi-cpufreq driver as we wanted to use policy->cpuinfo.max_freq for which the policy was required to be verified.

That is no longer the case and we can do the pr_warn() right from ->init() callback now. Remove acpi_cpufreq_cpu_ready().

---
 drivers/cpufreq/acpi-cpufreq.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/cpufreq/acpi-cpufreq.c +3 -11
index b49612895c78..28467d83c745 100644
@@ -889,6 +889,9 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
 	policy->fast_switch_possible = !acpi_pstate_strict &&
 		!(policy_is_shared(policy) && policy->shared_type != CPUFREQ_SHARED_TYPE_ANY);
 
+	if (perf->states[0].core_frequency * 1000 != freq_table[0].frequency)
+		pr_warn(FW_WARN "P-state 0 is not max freq\n");
+
 	return result;
 
 err_unreg:
@@ -918,16 +921,6 @@ static int acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy)
 	return 0;
 }
 
-static void acpi_cpufreq_cpu_ready(struct cpufreq_policy *policy)
-{
-	struct acpi_processor_performance *perf = per_cpu_ptr(acpi_perf_data,
-							      policy->cpu);
-	unsigned int freq = policy->freq_table[0].frequency;
-
-	if (perf->states[0].core_frequency * 1000 != freq)
-		pr_warn(FW_WARN "P-state 0 is not max freq\n");
-}
-
 static int acpi_cpufreq_resume(struct cpufreq_policy *policy)
 {
 	struct acpi_cpufreq_data *data = policy->driver_data;
@@ -955,7 +948,6 @@ static struct cpufreq_driver acpi_cpufreq_driver = {
 	.bios_limit	= acpi_processor_get_bios_limit,
 	.init		= acpi_cpufreq_cpu_init,
 	.exit		= acpi_cpufreq_cpu_exit,
-	.ready		= acpi_cpufreq_cpu_ready,
 	.resume		= acpi_cpufreq_resume,
 	.name		= "acpi-cpufreq",
 	.attr		= acpi_cpufreq_attr,
Signature · 1 line
2.31.1.272.g89b43f80a514
author maintainer
#2 lore raw

PATCH 2/3 cpufreq: sh: Remove sh_cpufreq_cpu_ready()

In reply to Viresh Kumar

The ->ready() callback is going away and since we don't do any important stuff in sh_cpufreq_cpu_ready(), remove it.

---
 drivers/cpufreq/sh-cpufreq.c | 11 -----------
 1 file changed, 11 deletions(-)
drivers/cpufreq/sh-cpufreq.c +0 -11
index 1a251e635ebd..b8704232c27b 100644
@@ -145,16 +145,6 @@ static int sh_cpufreq_cpu_exit(struct cpufreq_policy *policy)
 	return 0;
 }
 
-static void sh_cpufreq_cpu_ready(struct cpufreq_policy *policy)
-{
-	struct device *dev = get_cpu_device(policy->cpu);
-
-	dev_info(dev, "CPU Frequencies - Minimum %u.%03u MHz, "
-	       "Maximum %u.%03u MHz.\n",
-	       policy->min / 1000, policy->min % 1000,
-	       policy->max / 1000, policy->max % 1000);
-}
-
 static struct cpufreq_driver sh_cpufreq_driver = {
 	.name		= "sh",
 	.flags		= CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING,
@@ -163,7 +153,6 @@ static struct cpufreq_driver sh_cpufreq_driver = {
 	.verify		= sh_cpufreq_verify,
 	.init		= sh_cpufreq_cpu_init,
 	.exit		= sh_cpufreq_cpu_exit,
-	.ready		= sh_cpufreq_cpu_ready,
 	.attr		= cpufreq_generic_attr,
 };
 
Signature · 1 line
2.31.1.272.g89b43f80a514
author maintainer
#3 lore raw

PATCH 3/3 cpufreq: Remove ready() callback

In reply to Viresh Kumar

This isn't used anymore, get rid of it.

---
 Documentation/cpu-freq/cpu-drivers.rst                    | 3 ---
 Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst | 2 --
 drivers/cpufreq/cpufreq.c                                 | 4 ----
 include/linux/cpufreq.h                                   | 3 ---
 4 files changed, 12 deletions(-)
Documentation/cpu-freq/cpu-drivers.rst +0 -3
index d84ededb66f9..3b32336a7803 100644
@@ -75,9 +75,6 @@ And optionally
  .resume - A pointer to a per-policy resume function which is called
  with interrupts disabled and _before_ the governor is started again.
 
- .ready - A pointer to a per-policy ready function which is called after
- the policy is fully initialized.
-
  .attr - A pointer to a NULL-terminated list of "struct freq_attr" which
  allow to export values to sysfs.
 
Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst +0 -2
index 5ae9cfa2ec55..334f30ae198b 100644
@@ -80,8 +80,6 @@ 并且可选择
  .resume - 一个指向per-policy恢复函数的指针,该函数在关中断且在调节器再一次开始前被
  调用。
 
- .ready - 一个指向per-policy准备函数的指针,该函数在策略完全初始化之后被调用。
-
  .attr - 一个指向NULL结尾的"struct freq_attr"列表的指针,该函数允许导出值到
  sysfs。
 
drivers/cpufreq/cpufreq.c +0 -4
index 7d5f170ecad1..5782b15a8caa 100644
@@ -1517,10 +1517,6 @@ static int cpufreq_online(unsigned int cpu)
 
 	kobject_uevent(&policy->kobj, KOBJ_ADD);
 
-	/* Callback for handling stuff after policy is ready */
-	if (cpufreq_driver->ready)
-		cpufreq_driver->ready(policy);
-
 	if (cpufreq_thermal_control_enabled(cpufreq_driver))
 		policy->cdev = of_cpufreq_cooling_register(policy);
 
include/linux/cpufreq.h +0 -3
index c65a1d7385f8..fe6acc04e5e5 100644
@@ -367,9 +367,6 @@ struct cpufreq_driver {
 	int		(*suspend)(struct cpufreq_policy *policy);
 	int		(*resume)(struct cpufreq_policy *policy);
 
-	/* Will be called after the driver is fully initialized */
-	void		(*ready)(struct cpufreq_policy *policy);
-
 	struct freq_attr **attr;
 
 	/* platform specific boost support code */
Signature · 1 line
2.31.1.272.g89b43f80a514
#4 lore raw
In reply to Viresh Kumar
Quoted 7 lines · Viresh Kumar

Remove the last few users of the ready() callback and get rid of it.

Viresh Kumar (3):
cpufreq: acpi: Remove acpi_cpufreq_cpu_ready()
cpufreq: sh: Remove sh_cpufreq_cpu_ready()
cpufreq: Remove ready() callback

All patches in the series applied, thanks!