|
@@ -239,7 +239,7 @@ acpi_remove_notify_handler(acpi_handle device,
|
|
|
union acpi_operand_object *obj_desc;
|
|
union acpi_operand_object *obj_desc;
|
|
|
union acpi_operand_object *handler_obj;
|
|
union acpi_operand_object *handler_obj;
|
|
|
union acpi_operand_object *previous_handler_obj;
|
|
union acpi_operand_object *previous_handler_obj;
|
|
|
- acpi_status status;
|
|
|
|
|
|
|
+ acpi_status status = AE_OK;
|
|
|
u32 i;
|
|
u32 i;
|
|
|
|
|
|
|
|
ACPI_FUNCTION_TRACE(acpi_remove_notify_handler);
|
|
ACPI_FUNCTION_TRACE(acpi_remove_notify_handler);
|
|
@@ -251,20 +251,17 @@ acpi_remove_notify_handler(acpi_handle device,
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /* Make sure all deferred notify tasks are completed */
|
|
|
|
|
-
|
|
|
|
|
- acpi_os_wait_events_complete();
|
|
|
|
|
-
|
|
|
|
|
- status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
|
|
|
|
- if (ACPI_FAILURE(status)) {
|
|
|
|
|
- return_ACPI_STATUS(status);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
/* Root Object. Global handlers are removed here */
|
|
/* Root Object. Global handlers are removed here */
|
|
|
|
|
|
|
|
if (device == ACPI_ROOT_OBJECT) {
|
|
if (device == ACPI_ROOT_OBJECT) {
|
|
|
for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) {
|
|
for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) {
|
|
|
if (handler_type & (i + 1)) {
|
|
if (handler_type & (i + 1)) {
|
|
|
|
|
+ status =
|
|
|
|
|
+ acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
|
|
|
|
+ if (ACPI_FAILURE(status)) {
|
|
|
|
|
+ return_ACPI_STATUS(status);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (!acpi_gbl_global_notify[i].handler ||
|
|
if (!acpi_gbl_global_notify[i].handler ||
|
|
|
(acpi_gbl_global_notify[i].handler !=
|
|
(acpi_gbl_global_notify[i].handler !=
|
|
|
handler)) {
|
|
handler)) {
|
|
@@ -277,31 +274,40 @@ acpi_remove_notify_handler(acpi_handle device,
|
|
|
|
|
|
|
|
acpi_gbl_global_notify[i].handler = NULL;
|
|
acpi_gbl_global_notify[i].handler = NULL;
|
|
|
acpi_gbl_global_notify[i].context = NULL;
|
|
acpi_gbl_global_notify[i].context = NULL;
|
|
|
|
|
+
|
|
|
|
|
+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
|
|
|
|
+
|
|
|
|
|
+ /* Make sure all deferred notify tasks are completed */
|
|
|
|
|
+
|
|
|
|
|
+ acpi_os_wait_events_complete();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- goto unlock_and_exit;
|
|
|
|
|
|
|
+ return_ACPI_STATUS(AE_OK);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/* All other objects: Are Notifies allowed on this object? */
|
|
/* All other objects: Are Notifies allowed on this object? */
|
|
|
|
|
|
|
|
if (!acpi_ev_is_notify_object(node)) {
|
|
if (!acpi_ev_is_notify_object(node)) {
|
|
|
- status = AE_TYPE;
|
|
|
|
|
- goto unlock_and_exit;
|
|
|
|
|
|
|
+ return_ACPI_STATUS(AE_TYPE);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/* Must have an existing internal object */
|
|
/* Must have an existing internal object */
|
|
|
|
|
|
|
|
obj_desc = acpi_ns_get_attached_object(node);
|
|
obj_desc = acpi_ns_get_attached_object(node);
|
|
|
if (!obj_desc) {
|
|
if (!obj_desc) {
|
|
|
- status = AE_NOT_EXIST;
|
|
|
|
|
- goto unlock_and_exit;
|
|
|
|
|
|
|
+ return_ACPI_STATUS(AE_NOT_EXIST);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/* Internal object exists. Find the handler and remove it */
|
|
/* Internal object exists. Find the handler and remove it */
|
|
|
|
|
|
|
|
for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) {
|
|
for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) {
|
|
|
if (handler_type & (i + 1)) {
|
|
if (handler_type & (i + 1)) {
|
|
|
|
|
+ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
|
|
|
|
+ if (ACPI_FAILURE(status)) {
|
|
|
|
|
+ return_ACPI_STATUS(status);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
handler_obj = obj_desc->common_notify.notify_list[i];
|
|
handler_obj = obj_desc->common_notify.notify_list[i];
|
|
|
previous_handler_obj = NULL;
|
|
previous_handler_obj = NULL;
|
|
|
|
|
|
|
@@ -329,10 +335,17 @@ acpi_remove_notify_handler(acpi_handle device,
|
|
|
handler_obj->notify.next[i];
|
|
handler_obj->notify.next[i];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
|
|
|
|
+
|
|
|
|
|
+ /* Make sure all deferred notify tasks are completed */
|
|
|
|
|
+
|
|
|
|
|
+ acpi_os_wait_events_complete();
|
|
|
acpi_ut_remove_reference(handler_obj);
|
|
acpi_ut_remove_reference(handler_obj);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ return_ACPI_STATUS(status);
|
|
|
|
|
+
|
|
|
unlock_and_exit:
|
|
unlock_and_exit:
|
|
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
|
|
return_ACPI_STATUS(status);
|
|
return_ACPI_STATUS(status);
|
|
@@ -842,10 +855,6 @@ acpi_remove_gpe_handler(acpi_handle gpe_device,
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /* Make sure all deferred GPE tasks are completed */
|
|
|
|
|
-
|
|
|
|
|
- acpi_os_wait_events_complete();
|
|
|
|
|
-
|
|
|
|
|
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
|
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
|
|
if (ACPI_FAILURE(status)) {
|
|
if (ACPI_FAILURE(status)) {
|
|
|
return_ACPI_STATUS(status);
|
|
return_ACPI_STATUS(status);
|
|
@@ -897,9 +906,17 @@ acpi_remove_gpe_handler(acpi_handle gpe_device,
|
|
|
(void)acpi_ev_add_gpe_reference(gpe_event_info);
|
|
(void)acpi_ev_add_gpe_reference(gpe_event_info);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
|
|
|
|
+ (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
|
|
|
|
+
|
|
|
|
|
+ /* Make sure all deferred GPE tasks are completed */
|
|
|
|
|
+
|
|
|
|
|
+ acpi_os_wait_events_complete();
|
|
|
|
|
+
|
|
|
/* Now we can free the handler object */
|
|
/* Now we can free the handler object */
|
|
|
|
|
|
|
|
ACPI_FREE(handler);
|
|
ACPI_FREE(handler);
|
|
|
|
|
+ return_ACPI_STATUS(status);
|
|
|
|
|
|
|
|
unlock_and_exit:
|
|
unlock_and_exit:
|
|
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|