GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / drivers / acpi / wakeup.c
blobf62a50c3ed3401e20fe7c0af8555584110cecb8e
1 /*
2 * wakeup.c - support wakeup devices
3 * Copyright (C) 2004 Li Shaohua <shaohua.li@intel.com>
4 */
6 #include <linux/init.h>
7 #include <linux/acpi.h>
8 #include <acpi/acpi_drivers.h>
9 #include <linux/kernel.h>
10 #include <linux/types.h>
12 #include "internal.h"
13 #include "sleep.h"
16 * We didn't lock acpi_device_lock in the file, because it invokes oops in
17 * suspend/resume and isn't really required as this is called in S-state. At
18 * that time, there is no device hotplug
19 **/
20 #define _COMPONENT ACPI_SYSTEM_COMPONENT
21 ACPI_MODULE_NAME("wakeup_devices")
23 /**
24 * acpi_enable_wakeup_devices - Enable wake-up device GPEs.
25 * @sleep_state: ACPI system sleep state.
27 * Enable wakeup device power of devices with the state.enable flag set and set
28 * the wakeup enable mask bits in the GPE registers that correspond to wakeup
29 * devices.
31 void acpi_enable_wakeup_devices(u8 sleep_state)
33 struct list_head *node, *next;
35 list_for_each_safe(node, next, &acpi_wakeup_device_list) {
36 struct acpi_device *dev =
37 container_of(node, struct acpi_device, wakeup_list);
39 if (!dev->wakeup.flags.valid
40 || !(dev->wakeup.state.enabled || dev->wakeup.prepare_count)
41 || sleep_state > (u32) dev->wakeup.sleep_state)
42 continue;
44 if (dev->wakeup.state.enabled)
45 acpi_enable_wakeup_device_power(dev, sleep_state);
47 /* The wake-up power should have been enabled already. */
48 acpi_gpe_wakeup(dev->wakeup.gpe_device, dev->wakeup.gpe_number,
49 ACPI_GPE_ENABLE);
53 /**
54 * acpi_disable_wakeup_devices - Disable devices' wakeup capability.
55 * @sleep_state: ACPI system sleep state.
57 void acpi_disable_wakeup_devices(u8 sleep_state)
59 struct list_head *node, *next;
61 list_for_each_safe(node, next, &acpi_wakeup_device_list) {
62 struct acpi_device *dev =
63 container_of(node, struct acpi_device, wakeup_list);
65 if (!dev->wakeup.flags.valid
66 || !(dev->wakeup.state.enabled || dev->wakeup.prepare_count)
67 || (sleep_state > (u32) dev->wakeup.sleep_state))
68 continue;
70 acpi_gpe_wakeup(dev->wakeup.gpe_device, dev->wakeup.gpe_number,
71 ACPI_GPE_DISABLE);
73 if (dev->wakeup.state.enabled)
74 acpi_disable_wakeup_device_power(dev);
78 int __init acpi_wakeup_device_init(void)
80 struct list_head *node, *next;
82 mutex_lock(&acpi_device_lock);
83 list_for_each_safe(node, next, &acpi_wakeup_device_list) {
84 struct acpi_device *dev = container_of(node,
85 struct acpi_device,
86 wakeup_list);
87 if (dev->wakeup.flags.always_enabled)
88 dev->wakeup.state.enabled = 1;
90 mutex_unlock(&acpi_device_lock);
91 return 0;