Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[sfrench/cifs-2.6.git] / drivers / cpufreq / cpufreq_stats.c
index 91ad342a6051f19e64f5e00478cf2a5f8ab7e9a7..1b8312b0200675e81722def6d6b51134594e1250 100644 (file)
@@ -25,8 +25,7 @@ static spinlock_t cpufreq_stats_lock;
 
 #define CPUFREQ_STATDEVICE_ATTR(_name,_mode,_show) \
 static struct freq_attr _attr_##_name = {\
-       .attr = {.name = __stringify(_name), .owner = THIS_MODULE, \
-               .mode = _mode, }, \
+       .attr = {.name = __stringify(_name), .mode = _mode, }, \
        .show = _show,\
 };
 
@@ -165,8 +164,7 @@ freq_table_get_index(struct cpufreq_stats *stat, unsigned int freq)
        return -1;
 }
 
-static void
-cpufreq_stats_free_table (unsigned int cpu)
+static void cpufreq_stats_free_table(unsigned int cpu)
 {
        struct cpufreq_stats *stat = cpufreq_stats_table[cpu];
        struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
@@ -306,23 +304,26 @@ cpufreq_stat_notifier_trans (struct notifier_block *nb, unsigned long val,
        return 0;
 }
 
-static int cpufreq_stat_cpu_callback(struct notifier_block *nfb,
-                                       unsigned long action, void *hcpu)
+static int __cpuinit cpufreq_stat_cpu_callback(struct notifier_block *nfb,
+                                              unsigned long action,
+                                              void *hcpu)
 {
        unsigned int cpu = (unsigned long)hcpu;
 
        switch (action) {
        case CPU_ONLINE:
+       case CPU_ONLINE_FROZEN:
                cpufreq_update_policy(cpu);
                break;
        case CPU_DEAD:
+       case CPU_DEAD_FROZEN:
                cpufreq_stats_free_table(cpu);
                break;
        }
        return NOTIFY_OK;
 }
 
-static struct notifier_block cpufreq_stat_cpu_notifier =
+static struct notifier_block cpufreq_stat_cpu_notifier __cpuinitdata =
 {
        .notifier_call = cpufreq_stat_cpu_callback,
 };
@@ -355,8 +356,7 @@ __init cpufreq_stats_init(void)
 
        register_hotcpu_notifier(&cpufreq_stat_cpu_notifier);
        for_each_online_cpu(cpu) {
-               cpufreq_stat_cpu_callback(&cpufreq_stat_cpu_notifier,
-                               CPU_ONLINE, (void *)(long)cpu);
+               cpufreq_update_policy(cpu);
        }
        return 0;
 }
@@ -370,16 +370,13 @@ __exit cpufreq_stats_exit(void)
        cpufreq_unregister_notifier(&notifier_trans_block,
                        CPUFREQ_TRANSITION_NOTIFIER);
        unregister_hotcpu_notifier(&cpufreq_stat_cpu_notifier);
-       lock_cpu_hotplug();
        for_each_online_cpu(cpu) {
-               cpufreq_stat_cpu_callback(&cpufreq_stat_cpu_notifier,
-                                               CPU_DEAD, (void *)(long)cpu);
+               cpufreq_stats_free_table(cpu);
        }
-       unlock_cpu_hotplug();
 }
 
 MODULE_AUTHOR ("Zou Nan hai <nanhai.zou@intel.com>");
-MODULE_DESCRIPTION ("'cpufreq_stats' - A driver to export cpufreq stats"
+MODULE_DESCRIPTION ("'cpufreq_stats' - A driver to export cpufreq stats "
                                "through sysfs filesystem");
 MODULE_LICENSE ("GPL");