aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2006-06-15 21:31:47 -0400
committerLen Brown <len.brown@intel.com>2006-06-15 21:31:47 -0400
commitc080a3e69dfb58ae9b8c7e70a1e33f4f4e493ea7 (patch)
tree849d913226a6d38b66bf5ad1ccf6ea07559009af /drivers/acpi
parentbf891bd65de65284f3964216fcde493dba5149db (diff)
parent36e430951af0b0d1bdfd50ce22e70079d02646df (diff)
Pull sem2mutex into release branch
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/pci_link.c25
-rw-r--r--drivers/acpi/processor_perflib.c23
-rw-r--r--drivers/acpi/scan.c1
3 files changed, 25 insertions, 24 deletions
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
index 07bc6dfe662b..b55ad1add1b0 100644
--- a/drivers/acpi/pci_link.c
+++ b/drivers/acpi/pci_link.c
@@ -38,6 +38,7 @@
38#include <linux/spinlock.h> 38#include <linux/spinlock.h>
39#include <linux/pm.h> 39#include <linux/pm.h>
40#include <linux/pci.h> 40#include <linux/pci.h>
41#include <linux/mutex.h>
41 42
42#include <acpi/acpi_bus.h> 43#include <acpi/acpi_bus.h>
43#include <acpi/acpi_drivers.h> 44#include <acpi/acpi_drivers.h>
@@ -91,7 +92,7 @@ static struct {
91 int count; 92 int count;
92 struct list_head entries; 93 struct list_head entries;
93} acpi_link; 94} acpi_link;
94DECLARE_MUTEX(acpi_link_lock); 95DEFINE_MUTEX(acpi_link_lock);
95 96
96/* -------------------------------------------------------------------------- 97/* --------------------------------------------------------------------------
97 PCI Link Device Management 98 PCI Link Device Management
@@ -641,19 +642,19 @@ acpi_pci_link_allocate_irq(acpi_handle handle,
641 return_VALUE(-1); 642 return_VALUE(-1);
642 } 643 }
643 644
644 down(&acpi_link_lock); 645 mutex_lock(&acpi_link_lock);
645 if (acpi_pci_link_allocate(link)) { 646 if (acpi_pci_link_allocate(link)) {
646 up(&acpi_link_lock); 647 mutex_unlock(&acpi_link_lock);
647 return_VALUE(-1); 648 return_VALUE(-1);
648 } 649 }
649 650
650 if (!link->irq.active) { 651 if (!link->irq.active) {
651 up(&acpi_link_lock); 652 mutex_unlock(&acpi_link_lock);
652 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link active IRQ is 0!\n")); 653 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link active IRQ is 0!\n"));
653 return_VALUE(-1); 654 return_VALUE(-1);
654 } 655 }
655 link->refcnt++; 656 link->refcnt++;
656 up(&acpi_link_lock); 657 mutex_unlock(&acpi_link_lock);
657 658
658 if (triggering) 659 if (triggering)
659 *triggering = link->irq.triggering; 660 *triggering = link->irq.triggering;
@@ -691,9 +692,9 @@ int acpi_pci_link_free_irq(acpi_handle handle)
691 return_VALUE(-1); 692 return_VALUE(-1);
692 } 693 }
693 694
694 down(&acpi_link_lock); 695 mutex_lock(&acpi_link_lock);
695 if (!link->irq.initialized) { 696 if (!link->irq.initialized) {
696 up(&acpi_link_lock); 697 mutex_unlock(&acpi_link_lock);
697 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link isn't initialized\n")); 698 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link isn't initialized\n"));
698 return_VALUE(-1); 699 return_VALUE(-1);
699 } 700 }
@@ -716,7 +717,7 @@ int acpi_pci_link_free_irq(acpi_handle handle)
716 if (link->refcnt == 0) { 717 if (link->refcnt == 0) {
717 acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); 718 acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL);
718 } 719 }
719 up(&acpi_link_lock); 720 mutex_unlock(&acpi_link_lock);
720 return_VALUE(link->irq.active); 721 return_VALUE(link->irq.active);
721} 722}
722 723
@@ -747,7 +748,7 @@ static int acpi_pci_link_add(struct acpi_device *device)
747 strcpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS); 748 strcpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS);
748 acpi_driver_data(device) = link; 749 acpi_driver_data(device) = link;
749 750
750 down(&acpi_link_lock); 751 mutex_lock(&acpi_link_lock);
751 result = acpi_pci_link_get_possible(link); 752 result = acpi_pci_link_get_possible(link);
752 if (result) 753 if (result)
753 goto end; 754 goto end;
@@ -782,7 +783,7 @@ static int acpi_pci_link_add(struct acpi_device *device)
782 end: 783 end:
783 /* disable all links -- to be activated on use */ 784 /* disable all links -- to be activated on use */
784 acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); 785 acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL);
785 up(&acpi_link_lock); 786 mutex_unlock(&acpi_link_lock);
786 787
787 if (result) 788 if (result)
788 kfree(link); 789 kfree(link);
@@ -837,9 +838,9 @@ static int acpi_pci_link_remove(struct acpi_device *device, int type)
837 838
838 link = (struct acpi_pci_link *)acpi_driver_data(device); 839 link = (struct acpi_pci_link *)acpi_driver_data(device);
839 840
840 down(&acpi_link_lock); 841 mutex_lock(&acpi_link_lock);
841 list_del(&link->node); 842 list_del(&link->node);
842 up(&acpi_link_lock); 843 mutex_unlock(&acpi_link_lock);
843 844
844 kfree(link); 845 kfree(link);
845 846
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
index f36db22ce1ae..44a7b168e0ec 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
@@ -583,13 +584,13 @@ acpi_processor_register_performance(struct acpi_processor_performance
583 584
584 if (acpi_processor_get_performance_info(pr)) { 585 if (acpi_processor_get_performance_info(pr)) {
585 pr->performance = NULL; 586 pr->performance = NULL;
586 up(&performance_sem); 587 mutex_unlock(&performance_mutex);
587 return_VALUE(-EIO); 588 return_VALUE(-EIO);
588 } 589 }
589 590
590 acpi_cpufreq_add_file(pr); 591 acpi_cpufreq_add_file(pr);
591 592
592 up(&performance_sem); 593 mutex_unlock(&performance_mutex);
593 return_VALUE(0); 594 return_VALUE(0);
594} 595}
595 596
@@ -603,11 +604,11 @@ acpi_processor_unregister_performance(struct acpi_processor_performance
603 604
604 ACPI_FUNCTION_TRACE("acpi_processor_unregister_performance"); 605 ACPI_FUNCTION_TRACE("acpi_processor_unregister_performance");
605 606
606 down(&performance_sem); 607 mutex_lock(&performance_mutex);
607 608
608 pr = processors[cpu]; 609 pr = processors[cpu];
609 if (!pr) { 610 if (!pr) {
610 up(&performance_sem); 611 mutex_unlock(&performance_mutex);
611 return_VOID; 612 return_VOID;
612 } 613 }
613 614
@@ -617,7 +618,7 @@ acpi_processor_unregister_performance(struct acpi_processor_performance
617 618
618 acpi_cpufreq_remove_file(pr); 619 acpi_cpufreq_remove_file(pr);
619 620
620 up(&performance_sem); 621 mutex_unlock(&performance_mutex);
621 622
622 return_VOID; 623 return_VOID;
623} 624}
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index fc676ac0e3ed..fe3693de7ba3 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -459,7 +459,6 @@ static int acpi_bus_get_perf_flags(struct acpi_device *device)
459 -------------------------------------------------------------------------- */ 459 -------------------------------------------------------------------------- */
460 460
461static LIST_HEAD(acpi_bus_drivers); 461static LIST_HEAD(acpi_bus_drivers);
462static DECLARE_MUTEX(acpi_bus_drivers_lock);
463 462
464/** 463/**
465 * acpi_bus_match - match device IDs to driver's supported IDs 464 * acpi_bus_match - match device IDs to driver's supported IDs