diff options
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/pci_link.c | 25 |
1 files changed, 13 insertions, 12 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; |
94 | DECLARE_MUTEX(acpi_link_lock); | 95 | DEFINE_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 | ||