cpufreq: Allow light-weight tear down and bring up of CPUs
authorViresh Kumar <viresh.kumar@linaro.org>
Tue, 12 Feb 2019 11:06:04 +0000 (16:36 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 12 Feb 2019 22:47:42 +0000 (23:47 +0100)
commit91a12e91dc39137906d929a4ff6f9c32c59697fa
tree43cb806788ec5b4fc8ff3f12445d9e5660531338
parent9795607dc41e7606e90e48bffe6927bee32cd336
cpufreq: Allow light-weight tear down and bring up of CPUs

The cpufreq core doesn't remove the cpufreq policy anymore on CPU
offline operation, rather that happens when the CPU device gets
unregistered from the kernel. This allows faster recovery when the CPU
comes back online. This is also very useful during system wide
suspend/resume where we offline all non-boot CPUs during suspend and
then bring them back on resume.

This commit takes the same idea a step ahead to allow drivers to do
light weight tear-down and bring-up during CPU offline and online
operations.

A new set of callbacks is introduced, online/offline(). online() gets
called when the first CPU of an inactive policy is brought up and
offline() gets called when all the CPUs of a policy are offlined.

The existing init/exit() callback get called on policy
creation/destruction. They also get called instead of online/offline()
callbacks if the online/offline() callbacks aren't provided.

This also moves around some code to get executed only for the new-policy
case going forward.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/cpufreq.c
include/linux/cpufreq.h