diff options
| -rw-r--r-- | drivers/acpi/acpica/evxfgpe.c | 49 | ||||
| -rw-r--r-- | drivers/acpi/osl.c | 25 | ||||
| -rw-r--r-- | drivers/acpi/video_detect.c | 5 | ||||
| -rw-r--r-- | drivers/acpi/wakeup.c | 6 |
4 files changed, 54 insertions, 31 deletions
diff --git a/drivers/acpi/acpica/evxfgpe.c b/drivers/acpi/acpica/evxfgpe.c index e9562a7cb2f9..3b20a3401b64 100644 --- a/drivers/acpi/acpica/evxfgpe.c +++ b/drivers/acpi/acpica/evxfgpe.c | |||
| @@ -212,37 +212,40 @@ acpi_setup_gpe_for_wake(acpi_handle wake_device, | |||
| 212 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 212 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | /* Validate wake_device is of type Device */ | ||
| 216 | |||
| 217 | device_node = ACPI_CAST_PTR(struct acpi_namespace_node, wake_device); | ||
| 218 | if (device_node->type != ACPI_TYPE_DEVICE) { | ||
| 219 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
| 220 | } | ||
| 221 | |||
| 222 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | 215 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
| 223 | 216 | ||
| 224 | /* Ensure that we have a valid GPE number */ | 217 | /* Ensure that we have a valid GPE number */ |
| 225 | 218 | ||
| 226 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); | 219 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); |
| 227 | if (gpe_event_info) { | 220 | if (!gpe_event_info) { |
| 228 | /* | 221 | goto unlock_and_exit; |
| 229 | * If there is no method or handler for this GPE, then the | 222 | } |
| 230 | * wake_device will be notified whenever this GPE fires (aka | 223 | |
| 231 | * "implicit notify") Note: The GPE is assumed to be | 224 | /* |
| 232 | * level-triggered (for windows compatibility). | 225 | * If there is no method or handler for this GPE, then the |
| 233 | */ | 226 | * wake_device will be notified whenever this GPE fires (aka |
| 234 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == | 227 | * "implicit notify") Note: The GPE is assumed to be |
| 235 | ACPI_GPE_DISPATCH_NONE) { | 228 | * level-triggered (for windows compatibility). |
| 236 | gpe_event_info->flags = | 229 | */ |
| 237 | (ACPI_GPE_DISPATCH_NOTIFY | | 230 | if (((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == |
| 238 | ACPI_GPE_LEVEL_TRIGGERED); | 231 | ACPI_GPE_DISPATCH_NONE) && (wake_device != ACPI_ROOT_OBJECT)) { |
| 239 | gpe_event_info->dispatch.device_node = device_node; | ||
| 240 | } | ||
| 241 | 232 | ||
| 242 | gpe_event_info->flags |= ACPI_GPE_CAN_WAKE; | 233 | /* Validate wake_device is of type Device */ |
| 243 | status = AE_OK; | 234 | |
| 235 | device_node = ACPI_CAST_PTR(struct acpi_namespace_node, | ||
| 236 | wake_device); | ||
| 237 | if (device_node->type != ACPI_TYPE_DEVICE) { | ||
| 238 | goto unlock_and_exit; | ||
| 239 | } | ||
| 240 | gpe_event_info->flags = (ACPI_GPE_DISPATCH_NOTIFY | | ||
| 241 | ACPI_GPE_LEVEL_TRIGGERED); | ||
| 242 | gpe_event_info->dispatch.device_node = device_node; | ||
| 244 | } | 243 | } |
| 245 | 244 | ||
| 245 | gpe_event_info->flags |= ACPI_GPE_CAN_WAKE; | ||
| 246 | status = AE_OK; | ||
| 247 | |||
| 248 | unlock_and_exit: | ||
| 246 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | 249 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
| 247 | return_ACPI_STATUS(status); | 250 | return_ACPI_STATUS(status); |
| 248 | } | 251 | } |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index b0931818cf98..c90c76aa7f8b 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
| @@ -636,17 +636,21 @@ EXPORT_SYMBOL(acpi_os_write_port); | |||
| 636 | acpi_status | 636 | acpi_status |
| 637 | acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width) | 637 | acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width) |
| 638 | { | 638 | { |
| 639 | u32 dummy; | ||
| 640 | void __iomem *virt_addr; | 639 | void __iomem *virt_addr; |
| 641 | int size = width / 8, unmap = 0; | 640 | unsigned int size = width / 8; |
| 641 | bool unmap = false; | ||
| 642 | u32 dummy; | ||
| 642 | 643 | ||
| 643 | rcu_read_lock(); | 644 | rcu_read_lock(); |
| 644 | virt_addr = acpi_map_vaddr_lookup(phys_addr, size); | 645 | virt_addr = acpi_map_vaddr_lookup(phys_addr, size); |
| 645 | rcu_read_unlock(); | ||
| 646 | if (!virt_addr) { | 646 | if (!virt_addr) { |
| 647 | rcu_read_unlock(); | ||
| 647 | virt_addr = acpi_os_ioremap(phys_addr, size); | 648 | virt_addr = acpi_os_ioremap(phys_addr, size); |
| 648 | unmap = 1; | 649 | if (!virt_addr) |
| 650 | return AE_BAD_ADDRESS; | ||
| 651 | unmap = true; | ||
| 649 | } | 652 | } |
| 653 | |||
| 650 | if (!value) | 654 | if (!value) |
| 651 | value = &dummy; | 655 | value = &dummy; |
| 652 | 656 | ||
| @@ -666,6 +670,8 @@ acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width) | |||
| 666 | 670 | ||
| 667 | if (unmap) | 671 | if (unmap) |
| 668 | iounmap(virt_addr); | 672 | iounmap(virt_addr); |
| 673 | else | ||
| 674 | rcu_read_unlock(); | ||
| 669 | 675 | ||
| 670 | return AE_OK; | 676 | return AE_OK; |
| 671 | } | 677 | } |
| @@ -674,14 +680,17 @@ acpi_status | |||
| 674 | acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width) | 680 | acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width) |
| 675 | { | 681 | { |
| 676 | void __iomem *virt_addr; | 682 | void __iomem *virt_addr; |
| 677 | int size = width / 8, unmap = 0; | 683 | unsigned int size = width / 8; |
| 684 | bool unmap = false; | ||
| 678 | 685 | ||
| 679 | rcu_read_lock(); | 686 | rcu_read_lock(); |
| 680 | virt_addr = acpi_map_vaddr_lookup(phys_addr, size); | 687 | virt_addr = acpi_map_vaddr_lookup(phys_addr, size); |
| 681 | rcu_read_unlock(); | ||
| 682 | if (!virt_addr) { | 688 | if (!virt_addr) { |
| 689 | rcu_read_unlock(); | ||
| 683 | virt_addr = acpi_os_ioremap(phys_addr, size); | 690 | virt_addr = acpi_os_ioremap(phys_addr, size); |
| 684 | unmap = 1; | 691 | if (!virt_addr) |
| 692 | return AE_BAD_ADDRESS; | ||
| 693 | unmap = true; | ||
| 685 | } | 694 | } |
| 686 | 695 | ||
| 687 | switch (width) { | 696 | switch (width) { |
| @@ -700,6 +709,8 @@ acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width) | |||
| 700 | 709 | ||
| 701 | if (unmap) | 710 | if (unmap) |
| 702 | iounmap(virt_addr); | 711 | iounmap(virt_addr); |
| 712 | else | ||
| 713 | rcu_read_unlock(); | ||
| 703 | 714 | ||
| 704 | return AE_OK; | 715 | return AE_OK; |
| 705 | } | 716 | } |
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 42d3d72dae85..5af3479714f6 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c | |||
| @@ -82,6 +82,11 @@ long acpi_is_video_device(struct acpi_device *device) | |||
| 82 | if (!device) | 82 | if (!device) |
| 83 | return 0; | 83 | return 0; |
| 84 | 84 | ||
| 85 | /* Is this device able to support video switching ? */ | ||
| 86 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy)) || | ||
| 87 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy))) | ||
| 88 | video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING; | ||
| 89 | |||
| 85 | /* Is this device able to retrieve a video ROM ? */ | 90 | /* Is this device able to retrieve a video ROM ? */ |
| 86 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy))) | 91 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy))) |
| 87 | video_caps |= ACPI_VIDEO_ROM_AVAILABLE; | 92 | video_caps |= ACPI_VIDEO_ROM_AVAILABLE; |
diff --git a/drivers/acpi/wakeup.c b/drivers/acpi/wakeup.c index ed6501452507..7bfbe40bc43b 100644 --- a/drivers/acpi/wakeup.c +++ b/drivers/acpi/wakeup.c | |||
| @@ -86,8 +86,12 @@ int __init acpi_wakeup_device_init(void) | |||
| 86 | struct acpi_device *dev = container_of(node, | 86 | struct acpi_device *dev = container_of(node, |
| 87 | struct acpi_device, | 87 | struct acpi_device, |
| 88 | wakeup_list); | 88 | wakeup_list); |
| 89 | if (device_can_wakeup(&dev->dev)) | 89 | if (device_can_wakeup(&dev->dev)) { |
| 90 | /* Button GPEs are supposed to be always enabled. */ | ||
| 91 | acpi_enable_gpe(dev->wakeup.gpe_device, | ||
| 92 | dev->wakeup.gpe_number); | ||
| 90 | device_set_wakeup_enable(&dev->dev, true); | 93 | device_set_wakeup_enable(&dev->dev, true); |
| 94 | } | ||
| 91 | } | 95 | } |
| 92 | mutex_unlock(&acpi_device_lock); | 96 | mutex_unlock(&acpi_device_lock); |
| 93 | return 0; | 97 | return 0; |
