aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/processor_perflib.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/processor_perflib.c')
-rw-r--r--drivers/acpi/processor_perflib.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
index abbdb37a7f5f..7c6f97e9c727 100644
--- a/drivers/acpi/processor_perflib.c
+++ b/drivers/acpi/processor_perflib.c
@@ -34,6 +34,7 @@
34#ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF 34#ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF
35#include <linux/proc_fs.h> 35#include <linux/proc_fs.h>
36#include <linux/seq_file.h> 36#include <linux/seq_file.h>
37#include <linux/mutex.h>
37 38
38#include <asm/uaccess.h> 39#include <asm/uaccess.h>
39#endif 40#endif
@@ -48,7 +49,7 @@
48#define _COMPONENT ACPI_PROCESSOR_COMPONENT 49#define _COMPONENT ACPI_PROCESSOR_COMPONENT
49ACPI_MODULE_NAME("acpi_processor") 50ACPI_MODULE_NAME("acpi_processor")
50 51
51static DECLARE_MUTEX(performance_sem); 52static DEFINE_MUTEX(performance_mutex);
52 53
53/* 54/*
54 * _PPC support is implemented as a CPUfreq policy notifier: 55 * _PPC support is implemented as a CPUfreq policy notifier:
@@ -72,7 +73,7 @@ static int acpi_processor_ppc_notifier(struct notifier_block *nb,
72 struct acpi_processor *pr; 73 struct acpi_processor *pr;
73 unsigned int ppc = 0; 74 unsigned int ppc = 0;
74 75
75 down(&performance_sem); 76 mutex_lock(&performance_mutex);
76 77
77 if (event != CPUFREQ_INCOMPATIBLE) 78 if (event != CPUFREQ_INCOMPATIBLE)
78 goto out; 79 goto out;
@@ -93,7 +94,7 @@ static int acpi_processor_ppc_notifier(struct notifier_block *nb,
93 core_frequency * 1000); 94 core_frequency * 1000);
94 95
95 out: 96 out:
96 up(&performance_sem); 97 mutex_unlock(&performance_mutex);
97 98
98 return 0; 99 return 0;
99} 100}
@@ -564,16 +565,16 @@ acpi_processor_register_performance(struct acpi_processor_performance
564 if (!(acpi_processor_ppc_status & PPC_REGISTERED)) 565 if (!(acpi_processor_ppc_status & PPC_REGISTERED))
565 return_VALUE(-EINVAL); 566 return_VALUE(-EINVAL);
566 567
567 down(&performance_sem); 568 mutex_lock(&performance_mutex);
568 569
569 pr = processors[cpu]; 570 pr = processors[cpu];
570 if (!pr) { 571 if (!pr) {
571 up(&performance_sem); 572 mutex_unlock(&performance_mutex);
572 return_VALUE(-ENODEV); 573 return_VALUE(-ENODEV);
573 } 574 }
574 575
575 if (pr->performance) { 576 if (pr->performance) {
576 up(&performance_sem); 577 mutex_unlock(&performance_mutex);
577 return_VALUE(-EBUSY); 578 return_VALUE(-EBUSY);
578 } 579 }
579 580
@@ -581,13 +582,13 @@ acpi_processor_register_performance(struct acpi_processor_performance
581 582
582 if (acpi_processor_get_performance_info(pr)) { 583 if (acpi_processor_get_performance_info(pr)) {
583 pr->performance = NULL; 584 pr->performance = NULL;
584 up(&performance_sem); 585 mutex_unlock(&performance_mutex);
585 return_VALUE(-EIO); 586 return_VALUE(-EIO);
586 } 587 }
587 588
588 acpi_cpufreq_add_file(pr); 589 acpi_cpufreq_add_file(pr);
589 590
590 up(&performance_sem); 591 mutex_unlock(&performance_mutex);
591 return_VALUE(0); 592 return_VALUE(0);
592} 593}
593 594
@@ -601,11 +602,11 @@ acpi_processor_unregister_performance(struct acpi_processor_performance
601 602
602 ACPI_FUNCTION_TRACE("acpi_processor_unregister_performance"); 603 ACPI_FUNCTION_TRACE("acpi_processor_unregister_performance");
603 604
604 down(&performance_sem); 605 mutex_lock(&performance_mutex);
605 606
606 pr = processors[cpu]; 607 pr = processors[cpu];
607 if (!pr) { 608 if (!pr) {
608 up(&performance_sem); 609 mutex_unlock(&performance_mutex);
609 return_VOID; 610 return_VOID;
610 } 611 }
611 612
@@ -614,7 +615,7 @@ acpi_processor_unregister_performance(struct acpi_processor_performance
614 615
615 acpi_cpufreq_remove_file(pr); 616 acpi_cpufreq_remove_file(pr);
616 617
617 up(&performance_sem); 618 mutex_unlock(&performance_mutex);
618 619
619 return_VOID; 620 return_VOID;
620} 621}