Merge tag 'renesas-boards-cleanups2-for-v3.19' of git://git.kernel.org/pub/scm/linux...
[firefly-linux-kernel-4.4.55.git] / drivers / acpi / acpica / evxface.c
index 11e5803b8b41958824c4f108954d6bb4ae37aaa8..55a58f3ec8dfa66de2ac6465ad71b7cacca1db58 100644 (file)
@@ -786,18 +786,26 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
        handler->method_node = gpe_event_info->dispatch.method_node;
        handler->original_flags = (u8)(gpe_event_info->flags &
                                       (ACPI_GPE_XRUPT_TYPE_MASK |
-                                       ACPI_GPE_DISPATCH_MASK));
+                                       ACPI_GPE_DISPATCH_MASK));
 
        /*
         * If the GPE is associated with a method, it may have been enabled
         * automatically during initialization, in which case it has to be
         * disabled now to avoid spurious execution of the handler.
         */
-
-       if ((handler->original_flags & ACPI_GPE_DISPATCH_METHOD)
-           && gpe_event_info->runtime_count) {
-               handler->originally_enabled = 1;
+       if (((handler->original_flags & ACPI_GPE_DISPATCH_METHOD) ||
+            (handler->original_flags & ACPI_GPE_DISPATCH_NOTIFY)) &&
+           gpe_event_info->runtime_count) {
+               handler->originally_enabled = TRUE;
                (void)acpi_ev_remove_gpe_reference(gpe_event_info);
+
+               /* Sanity check of original type against new type */
+
+               if (type !=
+                   (u32)(gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK)) {
+                       ACPI_WARNING((AE_INFO,
+                                     "GPE type mismatch (level/edge)"));
+               }
        }
 
        /* Install the handler */
@@ -808,7 +816,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
 
        gpe_event_info->flags &=
            ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK);
-       gpe_event_info->flags |= (u8) (type | ACPI_GPE_DISPATCH_HANDLER);
+       gpe_event_info->flags |= (u8)(type | ACPI_GPE_DISPATCH_HANDLER);
 
        acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
 
@@ -893,7 +901,7 @@ acpi_remove_gpe_handler(acpi_handle gpe_device,
 
        gpe_event_info->dispatch.method_node = handler->method_node;
        gpe_event_info->flags &=
-               ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK);
+           ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK);
        gpe_event_info->flags |= handler->original_flags;
 
        /*
@@ -901,7 +909,8 @@ acpi_remove_gpe_handler(acpi_handle gpe_device,
         * enabled, it should be enabled at this point to restore the
         * post-initialization configuration.
         */
-       if ((handler->original_flags & ACPI_GPE_DISPATCH_METHOD) &&
+       if (((handler->original_flags & ACPI_GPE_DISPATCH_METHOD) ||
+            (handler->original_flags & ACPI_GPE_DISPATCH_NOTIFY)) &&
            handler->originally_enabled) {
                (void)acpi_ev_add_gpe_reference(gpe_event_info);
        }
@@ -946,7 +955,7 @@ ACPI_EXPORT_SYMBOL(acpi_remove_gpe_handler)
  * handle is returned.
  *
  ******************************************************************************/
-acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle)
+acpi_status acpi_acquire_global_lock(u16 timeout, u32 *handle)
 {
        acpi_status status;