ACPICA: Introduce acpi_dispatch_gpe()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 25 May 2018 08:30:35 +0000 (10:30 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 25 May 2018 08:30:35 +0000 (10:30 +0200)
Introduce acpi_dispatch_gpe() as a wrapper around acpi_ev_detect_gpe()
for checking if the given GPE (as represented by a GPE device handle
and a GPE number) is currently active and dispatching it (if that's
the case) outside of interrupt context.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/acpica/evgpe.c
drivers/acpi/acpica/evxfgpe.c
include/acpi/acpixf.h

index abbd59063906c57f236e20ca81025a99be0fbeab..e10fec99a182eca363167e27e1a6338e42586c09 100644 (file)
@@ -634,6 +634,12 @@ acpi_ev_detect_gpe(struct acpi_namespace_node *gpe_device,
 
        flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
 
+       if (!gpe_event_info) {
+               gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
+               if (!gpe_event_info)
+                       goto error_exit;
+       }
+
        /* Get the info block for the entire GPE register */
 
        gpe_register_info = gpe_event_info->register_info;
index c80e3bdf48057045032936a8dd6bd2e6bf9739e8..b2d5f66cc1b055863492567007fee2444bfa1150 100644 (file)
@@ -637,6 +637,28 @@ unlock_and_exit:
 
 ACPI_EXPORT_SYMBOL(acpi_get_gpe_status)
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_gispatch_gpe
+ *
+ * PARAMETERS:  gpe_device          - Parent GPE Device. NULL for GPE0/GPE1
+ *              gpe_number          - GPE level within the GPE block
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Detect and dispatch a General Purpose Event to either a function
+ *              (e.g. EC) or method (e.g. _Lxx/_Exx) handler.
+ *
+ ******************************************************************************/
+void acpi_dispatch_gpe(acpi_handle gpe_device, u32 gpe_number)
+{
+       ACPI_FUNCTION_TRACE(acpi_dispatch_gpe);
+
+       acpi_ev_detect_gpe(gpe_device, NULL, gpe_number);
+}
+
+ACPI_EXPORT_SYMBOL(acpi_dispatch_gpe)
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_finish_gpe
index da0215ea9f44e705a2832842c7655c99dddb0cb5..c01d790c17c2e4d218d2b6e5d2ff7af8622d9b5f 100644 (file)
@@ -753,6 +753,7 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
                                                     u32 gpe_number,
                                                     acpi_event_status
                                                     *event_status))
+ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_dispatch_gpe(acpi_handle gpe_device, u32 gpe_number))
 ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable_all_gpes(void))
 ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable_all_runtime_gpes(void))
 ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable_all_wakeup_gpes(void))