ACPICA: Restructure includes into public/private
[deliverable/linux.git] / drivers / acpi / events / evmisc.c
index 2113e58e2221520b6091155b84ac3ab8b9956197..16f2c1a00167cbfac9addeb329fbb5f4fcca64db 100644 (file)
@@ -42,6 +42,7 @@
  */
 
 #include <acpi/acpi.h>
+#include <acpi/accommon.h>
 #include <acpi/acevents.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acinterp.h>
 #define _COMPONENT          ACPI_EVENTS
 ACPI_MODULE_NAME("evmisc")
 
-/* Pointer to FACS needed for the Global Lock */
-static struct acpi_table_facs *facs = NULL;
-
 /* Local prototypes */
-
 static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context);
 
 static u32 acpi_ev_global_lock_handler(void *context);
@@ -152,7 +149,9 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
                        break;
 
                default:
+
                        /* All other types are not supported */
+
                        return (AE_TYPE);
                }
        }
@@ -193,9 +192,8 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
                        acpi_ut_delete_generic_state(notify_info);
                }
        } else {
-               /*
-                * There is no notify handler (per-device or system) for this device.
-                */
+               /* There is no notify handler (per-device or system) for this device */
+
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
                                  "No notify handler for Notify (%4.4s, %X) node %p\n",
                                  acpi_ut_get_node_name(node), notify_value,
@@ -229,9 +227,8 @@ static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context)
        ACPI_FUNCTION_ENTRY();
 
        /*
-        * We will invoke a global notify handler if installed.
-        * This is done _before_ we invoke the per-device handler attached
-        * to the device.
+        * We will invoke a global notify handler if installed. This is done
+        * _before_ we invoke the per-device handler attached to the device.
         */
        if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) {
 
@@ -299,7 +296,7 @@ static u32 acpi_ev_global_lock_handler(void *context)
         * If we don't get it now, it will be marked pending and we will
         * take another interrupt when it becomes free.
         */
-       ACPI_ACQUIRE_GLOBAL_LOCK(facs, acquired);
+       ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_FACS, acquired);
        if (acquired) {
 
                /* Got the lock, now wake all threads waiting for it */
@@ -336,34 +333,27 @@ acpi_status acpi_ev_init_global_lock_handler(void)
 
        ACPI_FUNCTION_TRACE(ev_init_global_lock_handler);
 
-       status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS,
-                                        ACPI_CAST_INDIRECT_PTR(struct
-                                                               acpi_table_header,
-                                                               &facs));
-       if (ACPI_FAILURE(status)) {
-               return_ACPI_STATUS(status);
-       }
+       /* Attempt installation of the global lock handler */
 
-       acpi_gbl_global_lock_present = TRUE;
        status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL,
                                                  acpi_ev_global_lock_handler,
                                                  NULL);
 
        /*
-        * If the global lock does not exist on this platform, the attempt
-        * to enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick)
-        * Map to AE_OK, but mark global lock as not present.
-        * Any attempt to actually use the global lock will be flagged
-        * with an error.
+        * If the global lock does not exist on this platform, the attempt to
+        * enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick).
+        * Map to AE_OK, but mark global lock as not present. Any attempt to
+        * actually use the global lock will be flagged with an error.
         */
        if (status == AE_NO_HARDWARE_RESPONSE) {
                ACPI_ERROR((AE_INFO,
                            "No response from Global Lock hardware, disabling lock"));
 
                acpi_gbl_global_lock_present = FALSE;
-               status = AE_OK;
+               return_ACPI_STATUS(AE_OK);
        }
 
+       acpi_gbl_global_lock_present = TRUE;
        return_ACPI_STATUS(status);
 }
 
@@ -462,8 +452,8 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout)
        }
 
        /*
-        * Make sure that a global lock actually exists. If not, just treat
-        * the lock as a standard mutex.
+        * Make sure that a global lock actually exists. If not, just treat the
+        * lock as a standard mutex.
         */
        if (!acpi_gbl_global_lock_present) {
                acpi_gbl_global_lock_acquired = TRUE;
@@ -472,7 +462,7 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout)
 
        /* Attempt to acquire the actual hardware lock */
 
-       ACPI_ACQUIRE_GLOBAL_LOCK(facs, acquired);
+       ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_FACS, acquired);
        if (acquired) {
 
                /* We got the lock */
@@ -536,7 +526,7 @@ acpi_status acpi_ev_release_global_lock(void)
 
                /* Allow any thread to release the lock */
 
-               ACPI_RELEASE_GLOBAL_LOCK(facs, pending);
+               ACPI_RELEASE_GLOBAL_LOCK(acpi_gbl_FACS, pending);
 
                /*
                 * If the pending bit was set, we must write GBL_RLS to the control
@@ -575,21 +565,21 @@ acpi_status acpi_ev_release_global_lock(void)
 
 void acpi_ev_terminate(void)
 {
-       acpi_native_uint i;
+       u32 i;
        acpi_status status;
 
        ACPI_FUNCTION_TRACE(ev_terminate);
 
        if (acpi_gbl_events_initialized) {
                /*
-                * Disable all event-related functionality.
-                * In all cases, on error, print a message but obviously we don't abort.
+                * Disable all event-related functionality. In all cases, on error,
+                * print a message but obviously we don't abort.
                 */
 
                /* Disable all fixed events */
 
                for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
-                       status = acpi_disable_event((u32) i, 0);
+                       status = acpi_disable_event(i, 0);
                        if (ACPI_FAILURE(status)) {
                                ACPI_ERROR((AE_INFO,
                                            "Could not disable fixed event %d",
@@ -599,7 +589,7 @@ void acpi_ev_terminate(void)
 
                /* Disable all GPEs in all GPE blocks */
 
-               status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block);
+               status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block, NULL);
 
                /* Remove SCI handler */
 
@@ -617,7 +607,7 @@ void acpi_ev_terminate(void)
 
        /* Deallocate all handler objects installed within GPE info structs */
 
-       status = acpi_ev_walk_gpe_list(acpi_ev_delete_gpe_handlers);
+       status = acpi_ev_walk_gpe_list(acpi_ev_delete_gpe_handlers, NULL);
 
        /* Return to original mode if necessary */
 
This page took 0.043651 seconds and 5 git commands to generate.