Commit 09f586b3 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6

* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6:
  ACPI / Video: Probe for output switch method when searching video devices.
  ACPI / Wakeup: Enable button GPEs unconditionally during initialization
  ACPI / ACPICA: Avoid crashing if _PRW is defined for the root object
  ACPI: Fix acpi_os_read_memory() and acpi_os_write_memory() (v2)
parents b9d4ba6b dc339743
...@@ -212,37 +212,40 @@ acpi_setup_gpe_for_wake(acpi_handle wake_device, ...@@ -212,37 +212,40 @@ acpi_setup_gpe_for_wake(acpi_handle wake_device,
return_ACPI_STATUS(AE_BAD_PARAMETER); return_ACPI_STATUS(AE_BAD_PARAMETER);
} }
/* Validate wake_device is of type Device */
device_node = ACPI_CAST_PTR(struct acpi_namespace_node, wake_device);
if (device_node->type != ACPI_TYPE_DEVICE) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
/* Ensure that we have a valid GPE number */ /* Ensure that we have a valid GPE number */
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
if (gpe_event_info) { if (!gpe_event_info) {
/* goto unlock_and_exit;
* If there is no method or handler for this GPE, then the }
* wake_device will be notified whenever this GPE fires (aka
* "implicit notify") Note: The GPE is assumed to be /*
* level-triggered (for windows compatibility). * If there is no method or handler for this GPE, then the
*/ * wake_device will be notified whenever this GPE fires (aka
if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == * "implicit notify") Note: The GPE is assumed to be
ACPI_GPE_DISPATCH_NONE) { * level-triggered (for windows compatibility).
gpe_event_info->flags = */
(ACPI_GPE_DISPATCH_NOTIFY | if (((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
ACPI_GPE_LEVEL_TRIGGERED); ACPI_GPE_DISPATCH_NONE) && (wake_device != ACPI_ROOT_OBJECT)) {
gpe_event_info->dispatch.device_node = device_node;
}
gpe_event_info->flags |= ACPI_GPE_CAN_WAKE; /* Validate wake_device is of type Device */
status = AE_OK;
device_node = ACPI_CAST_PTR(struct acpi_namespace_node,
wake_device);
if (device_node->type != ACPI_TYPE_DEVICE) {
goto unlock_and_exit;
}
gpe_event_info->flags = (ACPI_GPE_DISPATCH_NOTIFY |
ACPI_GPE_LEVEL_TRIGGERED);
gpe_event_info->dispatch.device_node = device_node;
} }
gpe_event_info->flags |= ACPI_GPE_CAN_WAKE;
status = AE_OK;
unlock_and_exit:
acpi_os_release_lock(acpi_gbl_gpe_lock, flags); acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
......
...@@ -636,17 +636,21 @@ EXPORT_SYMBOL(acpi_os_write_port); ...@@ -636,17 +636,21 @@ EXPORT_SYMBOL(acpi_os_write_port);
acpi_status acpi_status
acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width) acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width)
{ {
u32 dummy;
void __iomem *virt_addr; void __iomem *virt_addr;
int size = width / 8, unmap = 0; unsigned int size = width / 8;
bool unmap = false;
u32 dummy;
rcu_read_lock(); rcu_read_lock();
virt_addr = acpi_map_vaddr_lookup(phys_addr, size); virt_addr = acpi_map_vaddr_lookup(phys_addr, size);
rcu_read_unlock();
if (!virt_addr) { if (!virt_addr) {
rcu_read_unlock();
virt_addr = acpi_os_ioremap(phys_addr, size); virt_addr = acpi_os_ioremap(phys_addr, size);
unmap = 1; if (!virt_addr)
return AE_BAD_ADDRESS;
unmap = true;
} }
if (!value) if (!value)
value = &dummy; value = &dummy;
...@@ -666,6 +670,8 @@ acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width) ...@@ -666,6 +670,8 @@ acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width)
if (unmap) if (unmap)
iounmap(virt_addr); iounmap(virt_addr);
else
rcu_read_unlock();
return AE_OK; return AE_OK;
} }
...@@ -674,14 +680,17 @@ acpi_status ...@@ -674,14 +680,17 @@ acpi_status
acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width) acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width)
{ {
void __iomem *virt_addr; void __iomem *virt_addr;
int size = width / 8, unmap = 0; unsigned int size = width / 8;
bool unmap = false;
rcu_read_lock(); rcu_read_lock();
virt_addr = acpi_map_vaddr_lookup(phys_addr, size); virt_addr = acpi_map_vaddr_lookup(phys_addr, size);
rcu_read_unlock();
if (!virt_addr) { if (!virt_addr) {
rcu_read_unlock();
virt_addr = acpi_os_ioremap(phys_addr, size); virt_addr = acpi_os_ioremap(phys_addr, size);
unmap = 1; if (!virt_addr)
return AE_BAD_ADDRESS;
unmap = true;
} }
switch (width) { switch (width) {
...@@ -700,6 +709,8 @@ acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width) ...@@ -700,6 +709,8 @@ acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width)
if (unmap) if (unmap)
iounmap(virt_addr); iounmap(virt_addr);
else
rcu_read_unlock();
return AE_OK; return AE_OK;
} }
......
...@@ -82,6 +82,11 @@ long acpi_is_video_device(struct acpi_device *device) ...@@ -82,6 +82,11 @@ long acpi_is_video_device(struct acpi_device *device)
if (!device) if (!device)
return 0; return 0;
/* Is this device able to support video switching ? */
if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy)) ||
ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy)))
video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING;
/* Is this device able to retrieve a video ROM ? */ /* Is this device able to retrieve a video ROM ? */
if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy))) if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy)))
video_caps |= ACPI_VIDEO_ROM_AVAILABLE; video_caps |= ACPI_VIDEO_ROM_AVAILABLE;
......
...@@ -86,8 +86,12 @@ int __init acpi_wakeup_device_init(void) ...@@ -86,8 +86,12 @@ int __init acpi_wakeup_device_init(void)
struct acpi_device *dev = container_of(node, struct acpi_device *dev = container_of(node,
struct acpi_device, struct acpi_device,
wakeup_list); wakeup_list);
if (device_can_wakeup(&dev->dev)) if (device_can_wakeup(&dev->dev)) {
/* Button GPEs are supposed to be always enabled. */
acpi_enable_gpe(dev->wakeup.gpe_device,
dev->wakeup.gpe_number);
device_set_wakeup_enable(&dev->dev, true); device_set_wakeup_enable(&dev->dev, true);
}
} }
mutex_unlock(&acpi_device_lock); mutex_unlock(&acpi_device_lock);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment