aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/intel_pstate.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpufreq/intel_pstate.c')
-rw-r--r--drivers/cpufreq/intel_pstate.c42
1 files changed, 14 insertions, 28 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 096fde0ebcb5..f6dd1e761129 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -662,6 +662,9 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
662 662
663 cpu = all_cpu_data[policy->cpu]; 663 cpu = all_cpu_data[policy->cpu];
664 664
665 if (!policy->cpuinfo.max_freq)
666 return -ENODEV;
667
665 intel_pstate_get_min_max(cpu, &min, &max); 668 intel_pstate_get_min_max(cpu, &min, &max);
666 669
667 limits.min_perf_pct = (policy->min * 100) / policy->cpuinfo.max_freq; 670 limits.min_perf_pct = (policy->min * 100) / policy->cpuinfo.max_freq;
@@ -747,37 +750,11 @@ static struct cpufreq_driver intel_pstate_driver = {
747 .owner = THIS_MODULE, 750 .owner = THIS_MODULE,
748}; 751};
749 752
750static void intel_pstate_exit(void)
751{
752 int cpu;
753
754 sysfs_remove_group(intel_pstate_kobject,
755 &intel_pstate_attr_group);
756 debugfs_remove_recursive(debugfs_parent);
757
758 cpufreq_unregister_driver(&intel_pstate_driver);
759
760 if (!all_cpu_data)
761 return;
762
763 get_online_cpus();
764 for_each_online_cpu(cpu) {
765 if (all_cpu_data[cpu]) {
766 del_timer_sync(&all_cpu_data[cpu]->timer);
767 kfree(all_cpu_data[cpu]);
768 }
769 }
770
771 put_online_cpus();
772 vfree(all_cpu_data);
773}
774module_exit(intel_pstate_exit);
775
776static int __initdata no_load; 753static int __initdata no_load;
777 754
778static int __init intel_pstate_init(void) 755static int __init intel_pstate_init(void)
779{ 756{
780 int rc = 0; 757 int cpu, rc = 0;
781 const struct x86_cpu_id *id; 758 const struct x86_cpu_id *id;
782 759
783 if (no_load) 760 if (no_load)
@@ -802,7 +779,16 @@ static int __init intel_pstate_init(void)
802 intel_pstate_sysfs_expose_params(); 779 intel_pstate_sysfs_expose_params();
803 return rc; 780 return rc;
804out: 781out:
805 intel_pstate_exit(); 782 get_online_cpus();
783 for_each_online_cpu(cpu) {
784 if (all_cpu_data[cpu]) {
785 del_timer_sync(&all_cpu_data[cpu]->timer);
786 kfree(all_cpu_data[cpu]);
787 }
788 }
789
790 put_online_cpus();
791 vfree(all_cpu_data);
806 return -ENODEV; 792 return -ENODEV;
807} 793}
808device_initcall(intel_pstate_init); 794device_initcall(intel_pstate_init);