cpufreq: Perform light-weight init/teardown during suspend/resume
authorSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Mon, 29 Jul 2013 22:55:25 +0000 (04:25 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 7 Aug 2013 21:02:49 +0000 (23:02 +0200)
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>
drivers/cpufreq/cpufreq.c
drivers/cpufreq/cpufreq_stats.c

index e0ace3d9382cc5e126df050bceca4b677e1c9ead..370abb66babc61eaaee57d8eb9bb4a34f42a4a47 100644 (file)
@@ -2040,22 +2040,26 @@ static int cpufreq_cpu_callback(struct notifier_block *nfb,
 {
        unsigned int cpu = (unsigned long)hcpu;
        struct device *dev;
+       bool frozen = false;
 
        dev = get_cpu_device(cpu);
        if (dev) {
-               switch (action) {
+
+               if (action & CPU_TASKS_FROZEN)
+                       frozen = true;
+
+               switch (action & ~CPU_TASKS_FROZEN) {
                case CPU_ONLINE:
-               case CPU_ONLINE_FROZEN:
-                       cpufreq_add_dev(dev, NULL);
+                       __cpufreq_add_dev(dev, NULL, frozen);
                        cpufreq_update_policy(cpu);
                        break;
+
                case CPU_DOWN_PREPARE:
-               case CPU_DOWN_PREPARE_FROZEN:
-                       __cpufreq_remove_dev(dev, NULL, false);
+                       __cpufreq_remove_dev(dev, NULL, frozen);
                        break;
+
                case CPU_DOWN_FAILED:
-               case CPU_DOWN_FAILED_FROZEN:
-                       cpufreq_add_dev(dev, NULL);
+                       __cpufreq_add_dev(dev, NULL, frozen);
                        break;
                }
        }
index bc73be225be59cd1b49a92c939447235050e523c..cb3841355454f0d79b73db914f59328a4400c99e 100644 (file)
@@ -349,11 +349,9 @@ static int cpufreq_stat_cpu_callback(struct notifier_block *nfb,
 
        switch (action) {
        case CPU_DOWN_PREPARE:
-       case CPU_DOWN_PREPARE_FROZEN:
                cpufreq_stats_free_sysfs(cpu);
                break;
        case CPU_DEAD:
-       case CPU_DEAD_FROZEN:
                cpufreq_stats_free_table(cpu);
                break;
        }