Skip to content

Commit 952da0c

Browse files
vireshkrafaeljw
authored andcommitted
cpufreq: powernv: Migrate to ->exit() callback instead of ->stop_cpu()
Commit 367dc4a ("cpufreq: Add stop CPU callback to cpufreq_driver interface") added the ->stop_cpu() callback to allow the drivers to do clean up before the CPU is completely down and its state can't be modified. At that time the CPU hotplug framework used to call the cpufreq core's registered notifier for different events like CPU_DOWN_PREPARE and CPU_POST_DEAD. The ->stop_cpu() callback was called during the CPU_DOWN_PREPARE event. This is no longer the case, cpuhp_cpufreq_offline() is called only once by the CPU hotplug core now and we don't really need two separate callbacks for cpufreq drivers, i.e. ->stop_cpu() and ->exit(), as everything can be done from the ->exit() callback itself. Migrate to using the ->exit() callback instead of ->stop_cpu(). Signed-off-by: Viresh Kumar <[email protected]> [ rjw: Minor changelog edits ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 9357a38 commit 952da0c

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

drivers/cpufreq/powernv-cpufreq.c

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,15 @@ static int powernv_cpufreq_cpu_init(struct cpufreq_policy *policy)
875875

876876
static int powernv_cpufreq_cpu_exit(struct cpufreq_policy *policy)
877877
{
878-
/* timer is deleted in cpufreq_cpu_stop() */
878+
struct powernv_smp_call_data freq_data;
879+
struct global_pstate_info *gpstates = policy->driver_data;
880+
881+
freq_data.pstate_id = idx_to_pstate(powernv_pstate_info.min);
882+
freq_data.gpstate_id = idx_to_pstate(powernv_pstate_info.min);
883+
smp_call_function_single(policy->cpu, set_pstate, &freq_data, 1);
884+
if (gpstates)
885+
del_timer_sync(&gpstates->timer);
886+
879887
kfree(policy->driver_data);
880888

881889
return 0;
@@ -1007,18 +1015,6 @@ static struct notifier_block powernv_cpufreq_opal_nb = {
10071015
.priority = 0,
10081016
};
10091017

1010-
static void powernv_cpufreq_stop_cpu(struct cpufreq_policy *policy)
1011-
{
1012-
struct powernv_smp_call_data freq_data;
1013-
struct global_pstate_info *gpstates = policy->driver_data;
1014-
1015-
freq_data.pstate_id = idx_to_pstate(powernv_pstate_info.min);
1016-
freq_data.gpstate_id = idx_to_pstate(powernv_pstate_info.min);
1017-
smp_call_function_single(policy->cpu, set_pstate, &freq_data, 1);
1018-
if (gpstates)
1019-
del_timer_sync(&gpstates->timer);
1020-
}
1021-
10221018
static unsigned int powernv_fast_switch(struct cpufreq_policy *policy,
10231019
unsigned int target_freq)
10241020
{
@@ -1042,7 +1038,6 @@ static struct cpufreq_driver powernv_cpufreq_driver = {
10421038
.target_index = powernv_cpufreq_target_index,
10431039
.fast_switch = powernv_fast_switch,
10441040
.get = powernv_cpufreq_get,
1045-
.stop_cpu = powernv_cpufreq_stop_cpu,
10461041
.attr = powernv_cpu_freq_attr,
10471042
};
10481043

0 commit comments

Comments
 (0)