Merge branch 'acpica' into release
authorLen Brown <len.brown@intel.com>
Fri, 18 Mar 2011 22:06:08 +0000 (18:06 -0400)
committerLen Brown <len.brown@intel.com>
Fri, 18 Mar 2011 22:06:08 +0000 (18:06 -0400)
17 files changed:
arch/ia64/include/asm/acpi.h
arch/ia64/kernel/acpi.c
arch/x86/include/asm/acpi.h
arch/x86/kernel/acpi/sleep.c
arch/x86/kernel/acpi/sleep.h
drivers/acpi/acpica/aclocal.h
drivers/acpi/acpica/evgpe.c
drivers/acpi/acpica/evxfgpe.c
drivers/acpi/button.c
drivers/acpi/debugfs.c
drivers/acpi/nvs.c
drivers/acpi/osl.c
drivers/acpi/scan.c
drivers/acpi/sleep.c
drivers/pci/pci-acpi.c
include/acpi/acpi_bus.h
include/linux/acpi_io.h

index 837dc82a013eb7f93b792bf0d4c713ce1939ba81..a06dfb13d518cbf350f70df5c68621ef65a145c3 100644 (file)
@@ -128,9 +128,9 @@ static inline const char *acpi_get_sysname (void)
 int acpi_request_vector (u32 int_type);
 int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
 
-/* routines for saving/restoring kernel state */
-extern int acpi_save_state_mem(void);
-extern void acpi_restore_state_mem(void);
+/* Low-level suspend routine. */
+extern int acpi_suspend_lowlevel(void);
+
 extern unsigned long acpi_wakeup_address;
 
 /*
index 90ebceb899a0840bd66deae5e9d4446ed027c7f4..a54d054ed4b0fc521fa734d31516c037ca12ab32 100644 (file)
@@ -1034,18 +1034,8 @@ int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)
 EXPORT_SYMBOL(acpi_unregister_ioapic);
 
 /*
- * acpi_save_state_mem() - save kernel state
+ * acpi_suspend_lowlevel() - save kernel state and suspend.
  *
  * TBD when when IA64 starts to support suspend...
  */
-int acpi_save_state_mem(void) { return 0; } 
-
-/*
- * acpi_restore_state()
- */
-void acpi_restore_state_mem(void) {}
-
-/*
- * do_suspend_lowlevel()
- */
-void do_suspend_lowlevel(void) {}
+int acpi_suspend_lowlevel(void) { return 0; }
index 4ea15ca89b2b1110c4d0f6032d8ddee9256fb0b4..ef14da1f4ec53264075ef94c8a090f235e89ad45 100644 (file)
@@ -113,9 +113,8 @@ static inline void acpi_disable_pci(void)
        acpi_noirq_set();
 }
 
-/* routines for saving/restoring kernel state */
-extern int acpi_save_state_mem(void);
-extern void acpi_restore_state_mem(void);
+/* Low-level suspend routine. */
+extern int acpi_suspend_lowlevel(void);
 
 extern unsigned long acpi_wakeup_address;
 
index 68d1537b8c812dbc2cf2f6e2fc60e8ab31f96578..5f1b747f6ef1b8d8a88f5784c0a5c56ad65bc86c 100644 (file)
@@ -29,14 +29,14 @@ static char temp_stack[4096];
 #endif
 
 /**
- * acpi_save_state_mem - save kernel state
+ * acpi_suspend_lowlevel - save kernel state
  *
  * Create an identity mapped page table and copy the wakeup routine to
  * low memory.
  *
  * Note that this is too late to change acpi_wakeup_address.
  */
-int acpi_save_state_mem(void)
+int acpi_suspend_lowlevel(void)
 {
        struct wakeup_header *header;
 
@@ -107,17 +107,10 @@ int acpi_save_state_mem(void)
        saved_magic = 0x123456789abcdef0L;
 #endif /* CONFIG_64BIT */
 
+       do_suspend_lowlevel();
        return 0;
 }
 
-/*
- * acpi_restore_state - undo effects of acpi_save_state_mem
- */
-void acpi_restore_state_mem(void)
-{
-}
-
-
 /**
  * acpi_reserve_wakeup_memory - do _very_ early ACPI initialisation
  *
index adbcbaa6f1df625182ceee51fa45a71b0b25e294..31ce13f20297f878b722cc8d5658e53716e902ed 100644 (file)
@@ -14,3 +14,5 @@ extern char swsusp_pg_dir[PAGE_SIZE];
 
 extern unsigned long acpi_copy_wakeup_routine(unsigned long);
 extern void wakeup_long64(void);
+
+extern void do_suspend_lowlevel(void);
index 01bcab1c5cc4452400190c93477a7d9d1eb12dcf..c7f743ca395bbcaf91d4b046cee29b804b871c3a 100644 (file)
@@ -397,10 +397,15 @@ struct acpi_gpe_handler_info {
        u8 originally_enabled;  /* True if GPE was originally enabled */
 };
 
+struct acpi_gpe_notify_object {
+       struct acpi_namespace_node *node;
+       struct acpi_gpe_notify_object *next;
+};
+
 union acpi_gpe_dispatch_info {
        struct acpi_namespace_node *method_node;        /* Method node for this GPE level */
        struct acpi_gpe_handler_info *handler;  /* Installed GPE handler */
-       struct acpi_namespace_node *device_node;        /* Parent _PRW device for implicit notify */
+       struct acpi_gpe_notify_object device;   /* List of _PRW devices for implicit notify */
 };
 
 /*
index 67d44ef2fbc1cd82fd8792139258b02b5d28badc..65c79add3b1982ae3432a830c4c94f37be60f39d 100644 (file)
@@ -466,6 +466,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
        acpi_status status;
        struct acpi_gpe_event_info *local_gpe_event_info;
        struct acpi_evaluate_info *info;
+       struct acpi_gpe_notify_object *notify_object;
 
        ACPI_FUNCTION_TRACE(ev_asynch_execute_gpe_method);
 
@@ -517,10 +518,18 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
                 * from this thread -- because handlers may in turn run other
                 * control methods.
                 */
-               status =
-                   acpi_ev_queue_notify_request(local_gpe_event_info->dispatch.
-                                                device_node,
-                                                ACPI_NOTIFY_DEVICE_WAKE);
+               status = acpi_ev_queue_notify_request(
+                               local_gpe_event_info->dispatch.device.node,
+                               ACPI_NOTIFY_DEVICE_WAKE);
+
+               notify_object = local_gpe_event_info->dispatch.device.next;
+               while (ACPI_SUCCESS(status) && notify_object) {
+                       status = acpi_ev_queue_notify_request(
+                                       notify_object->node,
+                                       ACPI_NOTIFY_DEVICE_WAKE);
+                       notify_object = notify_object->next;
+               }
+
                break;
 
        case ACPI_GPE_DISPATCH_METHOD:
index 3b20a3401b641d0a8039f5ecff7cd55f9d1cfc01..52aaff3df562b94ffbd73206ae0cf363001e42bd 100644 (file)
@@ -198,7 +198,9 @@ acpi_setup_gpe_for_wake(acpi_handle wake_device,
        acpi_status status = AE_BAD_PARAMETER;
        struct acpi_gpe_event_info *gpe_event_info;
        struct acpi_namespace_node *device_node;
+       struct acpi_gpe_notify_object *notify_object;
        acpi_cpu_flags flags;
+       u8 gpe_dispatch_mask;
 
        ACPI_FUNCTION_TRACE(acpi_setup_gpe_for_wake);
 
@@ -221,27 +223,49 @@ acpi_setup_gpe_for_wake(acpi_handle wake_device,
                goto unlock_and_exit;
        }
 
+       if (wake_device == ACPI_ROOT_OBJECT) {
+               goto out;
+       }
+
        /*
         * 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 (((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
-             ACPI_GPE_DISPATCH_NONE) && (wake_device != ACPI_ROOT_OBJECT)) {
+       gpe_dispatch_mask = gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK;
+       if (gpe_dispatch_mask != ACPI_GPE_DISPATCH_NONE
+           && gpe_dispatch_mask != ACPI_GPE_DISPATCH_NOTIFY) {
+               goto out;
+       }
 
-               /* Validate wake_device is of type Device */
+       /* 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) {
-                       goto unlock_and_exit;
-               }
+       device_node = ACPI_CAST_PTR(struct acpi_namespace_node, wake_device);
+       if (device_node->type != ACPI_TYPE_DEVICE) {
+               goto unlock_and_exit;
+       }
+
+       if (gpe_dispatch_mask == ACPI_GPE_DISPATCH_NONE) {
                gpe_event_info->flags = (ACPI_GPE_DISPATCH_NOTIFY |
                                         ACPI_GPE_LEVEL_TRIGGERED);
-               gpe_event_info->dispatch.device_node = device_node;
+               gpe_event_info->dispatch.device.node = device_node;
+               gpe_event_info->dispatch.device.next = NULL;
+       } else {
+               /* There are multiple devices to notify implicitly. */
+
+               notify_object = ACPI_ALLOCATE_ZEROED(sizeof(*notify_object));
+               if (!notify_object) {
+                       status = AE_NO_MEMORY;
+                       goto unlock_and_exit;
+               }
+
+               notify_object->node = device_node;
+               notify_object->next = gpe_event_info->dispatch.device.next;
+               gpe_event_info->dispatch.device.next = notify_object;
        }
 
+ out:
        gpe_event_info->flags |= ACPI_GPE_CAN_WAKE;
        status = AE_OK;
 
index 76bbb78a5ad957525c066b90ec2457ae533934e6..12c28f4adb671aff43f9e86c42f7fe89263e73c3 100644 (file)
@@ -98,6 +98,7 @@ struct acpi_button {
        struct input_dev *input;
        char phys[32];                  /* for input device */
        unsigned long pushed;
+       bool wakeup_enabled;
 };
 
 static const struct file_operations acpi_button_info_fops = {
@@ -430,8 +431,10 @@ static int acpi_button_add(struct acpi_device *device)
                /* Button's GPE is run-wake GPE */
                acpi_enable_gpe(device->wakeup.gpe_device,
                                device->wakeup.gpe_number);
-               device->wakeup.run_wake_count++;
-               device_set_wakeup_enable(&device->dev, true);
+               if (!device_may_wakeup(&device->dev)) {
+                       device_set_wakeup_enable(&device->dev, true);
+                       button->wakeup_enabled = true;
+               }
        }
 
        printk(KERN_INFO PREFIX "%s [%s]\n", name, acpi_device_bid(device));
@@ -453,8 +456,8 @@ static int acpi_button_remove(struct acpi_device *device, int type)
        if (device->wakeup.flags.valid) {
                acpi_disable_gpe(device->wakeup.gpe_device,
                                device->wakeup.gpe_number);
-               device->wakeup.run_wake_count--;
-               device_set_wakeup_enable(&device->dev, false);
+               if (button->wakeup_enabled)
+                       device_set_wakeup_enable(&device->dev, false);
        }
 
        acpi_button_remove_fs(device);
index 5df67f1d6c612537f10ac2fd84b6720911d16723..384f7abcff77984fb67c21c34b462761bc8f611e 100644 (file)
@@ -26,7 +26,9 @@ static ssize_t cm_write(struct file *file, const char __user * user_buf,
                        size_t count, loff_t *ppos)
 {
        static char *buf;
-       static int uncopied_bytes;
+       static u32 max_size;
+       static u32 uncopied_bytes;
+
        struct acpi_table_header table;
        acpi_status status;
 
@@ -37,19 +39,24 @@ static ssize_t cm_write(struct file *file, const char __user * user_buf,
                if (copy_from_user(&table, user_buf,
                                   sizeof(struct acpi_table_header)))
                        return -EFAULT;
-               uncopied_bytes = table.length;
-               buf = kzalloc(uncopied_bytes, GFP_KERNEL);
+               uncopied_bytes = max_size = table.length;
+               buf = kzalloc(max_size, GFP_KERNEL);
                if (!buf)
                        return -ENOMEM;
        }
 
-       if (uncopied_bytes < count) {
-               kfree(buf);
+       if (buf == NULL)
+               return -EINVAL;
+
+       if ((*ppos > max_size) ||
+           (*ppos + count > max_size) ||
+           (*ppos + count < count) ||
+           (count > uncopied_bytes))
                return -EINVAL;
-       }
 
        if (copy_from_user(buf + (*ppos), user_buf, count)) {
                kfree(buf);
+               buf = NULL;
                return -EFAULT;
        }
 
@@ -59,6 +66,7 @@ static ssize_t cm_write(struct file *file, const char __user * user_buf,
        if (!uncopied_bytes) {
                status = acpi_install_method(buf);
                kfree(buf);
+               buf = NULL;
                if (ACPI_FAILURE(status))
                        return -EINVAL;
                add_taint(TAINT_OVERRIDDEN_ACPI_TABLE);
index fa5a1df42b79a40a817d27f036789d7bcd3a3c38..096787b43c960a71afd971ed8f312ba39e7787a9 100644 (file)
@@ -26,6 +26,7 @@ struct nvs_page {
        unsigned int size;
        void *kaddr;
        void *data;
+       bool unmap;
        struct list_head node;
 };
 
@@ -44,6 +45,9 @@ int suspend_nvs_register(unsigned long start, unsigned long size)
 {
        struct nvs_page *entry, *next;
 
+       pr_info("PM: Registering ACPI NVS region at %lx (%ld bytes)\n",
+               start, size);
+
        while (size > 0) {
                unsigned int nr_bytes;
 
@@ -81,7 +85,13 @@ void suspend_nvs_free(void)
                        free_page((unsigned long)entry->data);
                        entry->data = NULL;
                        if (entry->kaddr) {
-                               iounmap(entry->kaddr);
+                               if (entry->unmap) {
+                                       iounmap(entry->kaddr);
+                                       entry->unmap = false;
+                               } else {
+                                       acpi_os_unmap_memory(entry->kaddr,
+                                                            entry->size);
+                               }
                                entry->kaddr = NULL;
                        }
                }
@@ -115,8 +125,14 @@ int suspend_nvs_save(void)
 
        list_for_each_entry(entry, &nvs_list, node)
                if (entry->data) {
-                       entry->kaddr = acpi_os_ioremap(entry->phys_start,
-                                                   entry->size);
+                       unsigned long phys = entry->phys_start;
+                       unsigned int size = entry->size;
+
+                       entry->kaddr = acpi_os_get_iomem(phys, size);
+                       if (!entry->kaddr) {
+                               entry->kaddr = acpi_os_ioremap(phys, size);
+                               entry->unmap = !!entry->kaddr;
+                       }
                        if (!entry->kaddr) {
                                suspend_nvs_free();
                                return -ENOMEM;
index c90c76aa7f8b79152ab4f449dbddbf9ba4983b93..45c6ac8790d7b77c5b17ad1ef1b6a0166c4ae864 100644 (file)
@@ -76,7 +76,6 @@ EXPORT_SYMBOL(acpi_in_debugger);
 extern char line_buf[80];
 #endif                         /*ENABLE_DEBUGGER */
 
-static unsigned int acpi_irq_irq;
 static acpi_osd_handler acpi_irq_handler;
 static void *acpi_irq_context;
 static struct workqueue_struct *kacpid_wq;
@@ -105,11 +104,11 @@ struct acpi_ioremap {
        void __iomem *virt;
        acpi_physical_address phys;
        acpi_size size;
-       struct kref ref;
+       unsigned long refcount;
 };
 
 static LIST_HEAD(acpi_ioremaps);
-static DEFINE_SPINLOCK(acpi_ioremap_lock);
+static DEFINE_MUTEX(acpi_ioremap_lock);
 
 static void __init acpi_osi_setup_late(void);
 
@@ -285,6 +284,22 @@ acpi_map_vaddr_lookup(acpi_physical_address phys, unsigned int size)
        return NULL;
 }
 
+void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size)
+{
+       struct acpi_ioremap *map;
+       void __iomem *virt = NULL;
+
+       mutex_lock(&acpi_ioremap_lock);
+       map = acpi_map_lookup(phys, size);
+       if (map) {
+               virt = map->virt + (phys - map->phys);
+               map->refcount++;
+       }
+       mutex_unlock(&acpi_ioremap_lock);
+       return virt;
+}
+EXPORT_SYMBOL_GPL(acpi_os_get_iomem);
+
 /* Must be called with 'acpi_ioremap_lock' or RCU read lock held. */
 static struct acpi_ioremap *
 acpi_map_lookup_virt(void __iomem *virt, acpi_size size)
@@ -302,8 +317,7 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size)
 void __iomem *__init_refok
 acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
 {
-       struct acpi_ioremap *map, *tmp_map;
-       unsigned long flags;
+       struct acpi_ioremap *map;
        void __iomem *virt;
        acpi_physical_address pg_off;
        acpi_size pg_sz;
@@ -316,14 +330,25 @@ acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
        if (!acpi_gbl_permanent_mmap)
                return __acpi_map_table((unsigned long)phys, size);
 
+       mutex_lock(&acpi_ioremap_lock);
+       /* Check if there's a suitable mapping already. */
+       map = acpi_map_lookup(phys, size);
+       if (map) {
+               map->refcount++;
+               goto out;
+       }
+
        map = kzalloc(sizeof(*map), GFP_KERNEL);
-       if (!map)
+       if (!map) {
+               mutex_unlock(&acpi_ioremap_lock);
                return NULL;
+       }
 
        pg_off = round_down(phys, PAGE_SIZE);
        pg_sz = round_up(phys + size, PAGE_SIZE) - pg_off;
        virt = acpi_os_ioremap(pg_off, pg_sz);
        if (!virt) {
+               mutex_unlock(&acpi_ioremap_lock);
                kfree(map);
                return NULL;
        }
@@ -332,62 +357,51 @@ acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
        map->virt = virt;
        map->phys = pg_off;
        map->size = pg_sz;
-       kref_init(&map->ref);
-
-       spin_lock_irqsave(&acpi_ioremap_lock, flags);
-       /* Check if page has already been mapped. */
-       tmp_map = acpi_map_lookup(phys, size);
-       if (tmp_map) {
-               kref_get(&tmp_map->ref);
-               spin_unlock_irqrestore(&acpi_ioremap_lock, flags);
-               iounmap(map->virt);
-               kfree(map);
-               return tmp_map->virt + (phys - tmp_map->phys);
-       }
+       map->refcount = 1;
+
        list_add_tail_rcu(&map->list, &acpi_ioremaps);
-       spin_unlock_irqrestore(&acpi_ioremap_lock, flags);
 
+ out:
+       mutex_unlock(&acpi_ioremap_lock);
        return map->virt + (phys - map->phys);
 }
 EXPORT_SYMBOL_GPL(acpi_os_map_memory);
 
-static void acpi_kref_del_iomap(struct kref *ref)
+static void acpi_os_drop_map_ref(struct acpi_ioremap *map)
 {
-       struct acpi_ioremap *map;
+       if (!--map->refcount)
+               list_del_rcu(&map->list);
+}
 
-       map = container_of(ref, struct acpi_ioremap, ref);
-       list_del_rcu(&map->list);
+static void acpi_os_map_cleanup(struct acpi_ioremap *map)
+{
+       if (!map->refcount) {
+               synchronize_rcu();
+               iounmap(map->virt);
+               kfree(map);
+       }
 }
 
 void __ref acpi_os_unmap_memory(void __iomem *virt, acpi_size size)
 {
        struct acpi_ioremap *map;
-       unsigned long flags;
-       int del;
 
        if (!acpi_gbl_permanent_mmap) {
                __acpi_unmap_table(virt, size);
                return;
        }
 
-       spin_lock_irqsave(&acpi_ioremap_lock, flags);
+       mutex_lock(&acpi_ioremap_lock);
        map = acpi_map_lookup_virt(virt, size);
        if (!map) {
-               spin_unlock_irqrestore(&acpi_ioremap_lock, flags);
-               printk(KERN_ERR PREFIX "%s: bad address %p\n", __func__, virt);
-               dump_stack();
+               mutex_unlock(&acpi_ioremap_lock);
+               WARN(true, PREFIX "%s: bad address %p\n", __func__, virt);
                return;
        }
+       acpi_os_drop_map_ref(map);
+       mutex_unlock(&acpi_ioremap_lock);
 
-       del = kref_put(&map->ref, acpi_kref_del_iomap);
-       spin_unlock_irqrestore(&acpi_ioremap_lock, flags);
-
-       if (!del)
-               return;
-
-       synchronize_rcu();
-       iounmap(map->virt);
-       kfree(map);
+       acpi_os_map_cleanup(map);
 }
 EXPORT_SYMBOL_GPL(acpi_os_unmap_memory);
 
@@ -397,7 +411,7 @@ void __init early_acpi_os_unmap_memory(void __iomem *virt, acpi_size size)
                __acpi_unmap_table(virt, size);
 }
 
-int acpi_os_map_generic_address(struct acpi_generic_address *addr)
+static int acpi_os_map_generic_address(struct acpi_generic_address *addr)
 {
        void __iomem *virt;
 
@@ -413,13 +427,10 @@ int acpi_os_map_generic_address(struct acpi_generic_address *addr)
 
        return 0;
 }
-EXPORT_SYMBOL_GPL(acpi_os_map_generic_address);
 
-void acpi_os_unmap_generic_address(struct acpi_generic_address *addr)
+static void acpi_os_unmap_generic_address(struct acpi_generic_address *addr)
 {
-       void __iomem *virt;
-       unsigned long flags;
-       acpi_size size = addr->bit_width / 8;
+       struct acpi_ioremap *map;
 
        if (addr->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY)
                return;
@@ -427,13 +438,17 @@ void acpi_os_unmap_generic_address(struct acpi_generic_address *addr)
        if (!addr->address || !addr->bit_width)
                return;
 
-       spin_lock_irqsave(&acpi_ioremap_lock, flags);
-       virt = acpi_map_vaddr_lookup(addr->address, size);
-       spin_unlock_irqrestore(&acpi_ioremap_lock, flags);
+       mutex_lock(&acpi_ioremap_lock);
+       map = acpi_map_lookup(addr->address, addr->bit_width / 8);
+       if (!map) {
+               mutex_unlock(&acpi_ioremap_lock);
+               return;
+       }
+       acpi_os_drop_map_ref(map);
+       mutex_unlock(&acpi_ioremap_lock);
 
-       acpi_os_unmap_memory(virt, size);
+       acpi_os_map_cleanup(map);
 }
-EXPORT_SYMBOL_GPL(acpi_os_unmap_generic_address);
 
 #ifdef ACPI_FUTURE_USAGE
 acpi_status
@@ -516,11 +531,15 @@ acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler,
        acpi_irq_stats_init();
 
        /*
-        * Ignore the GSI from the core, and use the value in our copy of the
-        * FADT. It may not be the same if an interrupt source override exists
-        * for the SCI.
+        * ACPI interrupts different from the SCI in our copy of the FADT are
+        * not supported.
         */
-       gsi = acpi_gbl_FADT.sci_interrupt;
+       if (gsi != acpi_gbl_FADT.sci_interrupt)
+               return AE_BAD_PARAMETER;
+
+       if (acpi_irq_handler)
+               return AE_ALREADY_ACQUIRED;
+
        if (acpi_gsi_to_irq(gsi, &irq) < 0) {
                printk(KERN_ERR PREFIX "SCI (ACPI GSI %d) not registered\n",
                       gsi);
@@ -531,20 +550,20 @@ acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler,
        acpi_irq_context = context;
        if (request_irq(irq, acpi_irq, IRQF_SHARED, "acpi", acpi_irq)) {
                printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq);
+               acpi_irq_handler = NULL;
                return AE_NOT_ACQUIRED;
        }
-       acpi_irq_irq = irq;
 
        return AE_OK;
 }
 
 acpi_status acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)
 {
-       if (irq) {
-               free_irq(irq, acpi_irq);
-               acpi_irq_handler = NULL;
-               acpi_irq_irq = 0;
-       }
+       if (irq != acpi_gbl_FADT.sci_interrupt)
+               return AE_BAD_PARAMETER;
+
+       free_irq(irq, acpi_irq);
+       acpi_irq_handler = NULL;
 
        return AE_OK;
 }
@@ -1603,7 +1622,7 @@ acpi_status __init acpi_os_initialize1(void)
 acpi_status acpi_os_terminate(void)
 {
        if (acpi_irq_handler) {
-               acpi_os_remove_interrupt_handler(acpi_irq_irq,
+               acpi_os_remove_interrupt_handler(acpi_gbl_FADT.sci_interrupt,
                                                 acpi_irq_handler);
        }
 
index b99e624946074143a28f6c0a236b0d002426117a..b136c9c1e531954dc27cc4bed422e1618e7681ee 100644 (file)
@@ -797,7 +797,6 @@ static void acpi_bus_set_run_wake_flags(struct acpi_device *device)
        acpi_status status;
        acpi_event_status event_status;
 
-       device->wakeup.run_wake_count = 0;
        device->wakeup.flags.notifier_present = 0;
 
        /* Power button, Lid switch always enable wakeup */
index d6a8cd14de2e824ddb15563aa625fa1d5236ea5a..84f57143ad7c1d6b385ba41c92a90b40741192a9 100644 (file)
@@ -199,8 +199,6 @@ static void acpi_pm_end(void)
 #endif /* CONFIG_ACPI_SLEEP */
 
 #ifdef CONFIG_SUSPEND
-extern void do_suspend_lowlevel(void);
-
 static u32 acpi_suspend_states[] = {
        [PM_SUSPEND_ON] = ACPI_STATE_S0,
        [PM_SUSPEND_STANDBY] = ACPI_STATE_S1,
@@ -243,20 +241,11 @@ static int acpi_suspend_begin(suspend_state_t pm_state)
 static int acpi_suspend_enter(suspend_state_t pm_state)
 {
        acpi_status status = AE_OK;
-       unsigned long flags = 0;
        u32 acpi_state = acpi_target_sleep_state;
+       int error;
 
        ACPI_FLUSH_CPU_CACHE();
 
-       /* Do arch specific saving of state. */
-       if (acpi_state == ACPI_STATE_S3) {
-               int error = acpi_save_state_mem();
-
-               if (error)
-                       return error;
-       }
-
-       local_irq_save(flags);
        switch (acpi_state) {
        case ACPI_STATE_S1:
                barrier();
@@ -264,7 +253,10 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
                break;
 
        case ACPI_STATE_S3:
-               do_suspend_lowlevel();
+               error = acpi_suspend_lowlevel();
+               if (error)
+                       return error;
+               pr_info(PREFIX "Low-level resume complete\n");
                break;
        }
 
@@ -290,13 +282,6 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
        /* Allow EC transactions to happen. */
        acpi_ec_unblock_transactions_early();
 
-       local_irq_restore(flags);
-       printk(KERN_DEBUG "Back to C!\n");
-
-       /* restore processor state */
-       if (acpi_state == ACPI_STATE_S3)
-               acpi_restore_state_mem();
-
        suspend_nvs_restore();
 
        return ACPI_SUCCESS(status) ? 0 : -EFAULT;
@@ -472,16 +457,13 @@ static int acpi_hibernation_begin(void)
 static int acpi_hibernation_enter(void)
 {
        acpi_status status = AE_OK;
-       unsigned long flags = 0;
 
        ACPI_FLUSH_CPU_CACHE();
 
-       local_irq_save(flags);
        /* This shouldn't return.  If it returns, we have a problem */
        status = acpi_enter_sleep_state(ACPI_STATE_S4);
        /* Reprogram control registers and execute _BFS */
        acpi_leave_sleep_state_prep(ACPI_STATE_S4);
-       local_irq_restore(flags);
 
        return ACPI_SUCCESS(status) ? 0 : -EFAULT;
 }
index 6fe0772e0e7de2432d9353d8871b3bc5e8ba04ee..7c3b18e78cee148d889a8a63ccc2fd4785eab81a 100644 (file)
@@ -293,19 +293,11 @@ static int acpi_dev_run_wake(struct device *phys_dev, bool enable)
        }
 
        if (enable) {
-               if (!dev->wakeup.run_wake_count++) {
-                       acpi_enable_wakeup_device_power(dev, ACPI_STATE_S0);
-                       acpi_enable_gpe(dev->wakeup.gpe_device,
-                                       dev->wakeup.gpe_number);
-               }
-       } else if (dev->wakeup.run_wake_count > 0) {
-               if (!--dev->wakeup.run_wake_count) {
-                       acpi_disable_gpe(dev->wakeup.gpe_device,
-                                        dev->wakeup.gpe_number);
-                       acpi_disable_wakeup_device_power(dev);
-               }
+               acpi_enable_wakeup_device_power(dev, ACPI_STATE_S0);
+               acpi_enable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number);
        } else {
-               error = -EALREADY;
+               acpi_disable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number);
+               acpi_disable_wakeup_device_power(dev);
        }
 
        return error;
index 78ca429929f7438959e6509dcd0f547cfb44afd5..f50ebb9bc53b806b7bb32d3fe242d017b164f40a 100644 (file)
@@ -250,7 +250,6 @@ struct acpi_device_wakeup {
        struct acpi_handle_list resources;
        struct acpi_device_wakeup_flags flags;
        int prepare_count;
-       int run_wake_count;
 };
 
 /* Device */
index 7180013a4a3aecd5d455802fce0ee4d74f479989..4afd7102459d7fbdef49be451141e16b0591f5e7 100644 (file)
@@ -10,7 +10,6 @@ static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
        return ioremap_cache(phys, size);
 }
 
-int acpi_os_map_generic_address(struct acpi_generic_address *addr);
-void acpi_os_unmap_generic_address(struct acpi_generic_address *addr);
+void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size);
 
 #endif