Merge branches 'acpi_pad', 'acpica', 'apei-bugzilla-43282', 'battery', 'cpuidle-coupl...
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / acpi / acpica / evgpeutil.c
index 3c43796b8361dd67447162f2c39ac2ca45e1d856..cb50dd91bc186a80f8fb36649c69086794d0c9cd 100644 (file)
@@ -54,7 +54,7 @@ ACPI_MODULE_NAME("evgpeutil")
  * FUNCTION:    acpi_ev_walk_gpe_list
  *
  * PARAMETERS:  gpe_walk_callback   - Routine called for each GPE block
- *              Context             - Value passed to callback
+ *              context             - Value passed to callback
  *
  * RETURN:      Status
  *
@@ -347,6 +347,8 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
                            void *context)
 {
        struct acpi_gpe_event_info *gpe_event_info;
+       struct acpi_gpe_notify_info *notify;
+       struct acpi_gpe_notify_info *next;
        u32 i;
        u32 j;
 
@@ -365,10 +367,28 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
 
                        if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
                            ACPI_GPE_DISPATCH_HANDLER) {
+
+                               /* Delete an installed handler block */
+
                                ACPI_FREE(gpe_event_info->dispatch.handler);
                                gpe_event_info->dispatch.handler = NULL;
                                gpe_event_info->flags &=
                                    ~ACPI_GPE_DISPATCH_MASK;
+                       } else if ((gpe_event_info->
+                                flags & ACPI_GPE_DISPATCH_MASK) ==
+                               ACPI_GPE_DISPATCH_NOTIFY) {
+
+                               /* Delete the implicit notification device list */
+
+                               notify = gpe_event_info->dispatch.notify_list;
+                               while (notify) {
+                                       next = notify->next;
+                                       ACPI_FREE(notify);
+                                       notify = next;
+                               }
+                               gpe_event_info->dispatch.notify_list = NULL;
+                               gpe_event_info->flags &=
+                                   ~ACPI_GPE_DISPATCH_MASK;
                        }
                }
        }