]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/acpi/bus.c
PCI ACPI: Rework PCI handling of wake-up
[linux-2.6-omap-h63xx.git] / drivers / acpi / bus.c
index 8b0d4b7d188a4b2cae701f50459cd80f39fd4a63..fc1110d6a0787a5d2da8e85b0fe3b9e7b15c6fa8 100644 (file)
 #include <linux/pm.h>
 #include <linux/device.h>
 #include <linux/proc_fs.h>
+#include <linux/acpi.h>
 #ifdef CONFIG_X86
 #include <asm/mpspec.h>
 #endif
+#include <linux/pci.h>
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 
 #define _COMPONENT             ACPI_BUS_COMPONENT
 ACPI_MODULE_NAME("bus");
-#ifdef CONFIG_X86
-extern void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger);
-#endif
 
 struct acpi_device *acpi_root;
 struct proc_dir_entry *acpi_root_dir;
@@ -296,6 +295,28 @@ int acpi_bus_set_power(acpi_handle handle, int state)
 
 EXPORT_SYMBOL(acpi_bus_set_power);
 
+bool acpi_bus_power_manageable(acpi_handle handle)
+{
+       struct acpi_device *device;
+       int result;
+
+       result = acpi_bus_get_device(handle, &device);
+       return result ? false : device->flags.power_manageable;
+}
+
+EXPORT_SYMBOL(acpi_bus_power_manageable);
+
+bool acpi_bus_can_wakeup(acpi_handle handle)
+{
+       struct acpi_device *device;
+       int result;
+
+       result = acpi_bus_get_device(handle, &device);
+       return result ? false : device->wakeup.flags.valid;
+}
+
+EXPORT_SYMBOL(acpi_bus_can_wakeup);
+
 /* --------------------------------------------------------------------------
                                 Event Management
    -------------------------------------------------------------------------- */
@@ -375,10 +396,11 @@ int acpi_bus_receive_event(struct acpi_bus_event *event)
        }
 
        spin_lock_irqsave(&acpi_bus_event_lock, flags);
-       entry =
-           list_entry(acpi_bus_event_list.next, struct acpi_bus_event, node);
-       if (entry)
+       if (!list_empty(&acpi_bus_event_list)) {
+               entry = list_entry(acpi_bus_event_list.next,
+                                  struct acpi_bus_event, node);
                list_del(&entry->node);
+       }
        spin_unlock_irqrestore(&acpi_bus_event_lock, flags);
 
        if (!entry)
@@ -653,8 +675,6 @@ void __init acpi_early_init(void)
 
 #ifdef CONFIG_X86
        if (!acpi_ioapic) {
-               extern u8 acpi_sci_flags;
-
                /* compatible (0) means level (3) */
                if (!(acpi_sci_flags & ACPI_MADT_TRIGGER_MASK)) {
                        acpi_sci_flags &= ~ACPI_MADT_TRIGGER_MASK;
@@ -664,7 +684,6 @@ void __init acpi_early_init(void)
                acpi_pic_sci_set_trigger(acpi_gbl_FADT.sci_interrupt,
                                         (acpi_sci_flags & ACPI_MADT_TRIGGER_MASK) >> 2);
        } else {
-               extern int acpi_sci_override_gsi;
                /*
                 * now that acpi_gbl_FADT is initialized,
                 * update it with result from INT_SRC_OVR parsing
@@ -781,13 +800,14 @@ static int __init acpi_init(void)
 
        acpi_kobj = kobject_create_and_add("acpi", firmware_kobj);
        if (!acpi_kobj) {
-               printk(KERN_WARNING "%s: kset create error\n", __FUNCTION__);
+               printk(KERN_WARNING "%s: kset create error\n", __func__);
                acpi_kobj = NULL;
        }
 
        result = acpi_bus_init();
 
        if (!result) {
+               pci_mmcfg_late_init();
                if (!(pm_flags & PM_APM))
                        pm_flags |= PM_ACPI;
                else {