Commit 5302c3fb2e62f4ca5e43e060491ba299f58c5231

Authored by Srivatsa S. Bhat
Committed by Rafael J. Wysocki
1 parent 8414809c6a

cpufreq: Perform light-weight init/teardown during suspend/resume

Now that we have the infrastructure to perform a light-weight init/tear-down,
use that in the cpufreq CPU hotplug notifier when invoked from the
suspend/resume path.

This also ensures that the file permissions of the cpufreq sysfs files are
preserved across suspend/resume, something which commit a66b2e (cpufreq:
Preserve sysfs files across suspend/resume) originally intended to do, but
had to be reverted due to other problems.

Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Showing 2 changed files with 11 additions and 9 deletions Side-by-side Diff

drivers/cpufreq/cpufreq.c
... ... @@ -2040,22 +2040,26 @@
2040 2040 {
2041 2041 unsigned int cpu = (unsigned long)hcpu;
2042 2042 struct device *dev;
  2043 + bool frozen = false;
2043 2044  
2044 2045 dev = get_cpu_device(cpu);
2045 2046 if (dev) {
2046   - switch (action) {
  2047 +
  2048 + if (action & CPU_TASKS_FROZEN)
  2049 + frozen = true;
  2050 +
  2051 + switch (action & ~CPU_TASKS_FROZEN) {
2047 2052 case CPU_ONLINE:
2048   - case CPU_ONLINE_FROZEN:
2049   - cpufreq_add_dev(dev, NULL);
  2053 + __cpufreq_add_dev(dev, NULL, frozen);
2050 2054 cpufreq_update_policy(cpu);
2051 2055 break;
  2056 +
2052 2057 case CPU_DOWN_PREPARE:
2053   - case CPU_DOWN_PREPARE_FROZEN:
2054   - __cpufreq_remove_dev(dev, NULL, false);
  2058 + __cpufreq_remove_dev(dev, NULL, frozen);
2055 2059 break;
  2060 +
2056 2061 case CPU_DOWN_FAILED:
2057   - case CPU_DOWN_FAILED_FROZEN:
2058   - cpufreq_add_dev(dev, NULL);
  2062 + __cpufreq_add_dev(dev, NULL, frozen);
2059 2063 break;
2060 2064 }
2061 2065 }
drivers/cpufreq/cpufreq_stats.c
... ... @@ -349,11 +349,9 @@
349 349  
350 350 switch (action) {
351 351 case CPU_DOWN_PREPARE:
352   - case CPU_DOWN_PREPARE_FROZEN:
353 352 cpufreq_stats_free_sysfs(cpu);
354 353 break;
355 354 case CPU_DEAD:
356   - case CPU_DEAD_FROZEN:
357 355 cpufreq_stats_free_table(cpu);
358 356 break;
359 357 }