提交 8e4319c4 编写于 作者: B Bob Moore 提交者: Len Brown

ACPICA: Fix several acpi_attach_data problems

Handler was never invoked. Now invoked if/when host node is deleted.
Data object was not automatically deleted when host node was deleted.
Interface to handler had an unused parameter, removed it.
ACPICA BZ 778.

http://acpica.org/bugzilla/show_bug.cgi?id=778Signed-off-by: NBob Moore <robert.moore@intel.com>
Signed-off-by: NLin Ming <ming.m.lin@intel.com>
Signed-off-by: NLen Brown <len.brown@intel.com>
上级 6557a49a
...@@ -144,6 +144,8 @@ struct acpi_namespace_node *acpi_ns_create_node(u32 name); ...@@ -144,6 +144,8 @@ struct acpi_namespace_node *acpi_ns_create_node(u32 name);
void acpi_ns_delete_node(struct acpi_namespace_node *node); void acpi_ns_delete_node(struct acpi_namespace_node *node);
void acpi_ns_remove_node(struct acpi_namespace_node *node);
void void
acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_handle); acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_handle);
......
...@@ -96,17 +96,68 @@ struct acpi_namespace_node *acpi_ns_create_node(u32 name) ...@@ -96,17 +96,68 @@ struct acpi_namespace_node *acpi_ns_create_node(u32 name)
* *
* RETURN: None * RETURN: None
* *
* DESCRIPTION: Delete a namespace node * DESCRIPTION: Delete a namespace node. All node deletions must come through
* here. Detaches any attached objects, including any attached
* data. If a handler is associated with attached data, it is
* invoked before the node is deleted.
* *
******************************************************************************/ ******************************************************************************/
void acpi_ns_delete_node(struct acpi_namespace_node *node) void acpi_ns_delete_node(struct acpi_namespace_node *node)
{
union acpi_operand_object *obj_desc;
ACPI_FUNCTION_NAME(ns_delete_node);
/* Detach an object if there is one */
acpi_ns_detach_object(node);
/*
* Delete an attached data object if present (an object that was created
* and attached via acpi_attach_data). Note: After any normal object is
* detached above, the only possible remaining object is a data object.
*/
obj_desc = node->object;
if (obj_desc && (obj_desc->common.type == ACPI_TYPE_LOCAL_DATA)) {
/* Invoke the attached data deletion handler if present */
if (obj_desc->data.handler) {
obj_desc->data.handler(node, obj_desc->data.pointer);
}
acpi_ut_remove_reference(obj_desc);
}
/* Now we can delete the node */
(void)acpi_os_release_object(acpi_gbl_namespace_cache, node);
ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++);
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Node %p, Remaining %X\n",
node, acpi_gbl_current_node_count));
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_remove_node
*
* PARAMETERS: Node - Node to be removed/deleted
*
* RETURN: None
*
* DESCRIPTION: Remove (unlink) and delete a namespace node
*
******************************************************************************/
void acpi_ns_remove_node(struct acpi_namespace_node *node)
{ {
struct acpi_namespace_node *parent_node; struct acpi_namespace_node *parent_node;
struct acpi_namespace_node *prev_node; struct acpi_namespace_node *prev_node;
struct acpi_namespace_node *next_node; struct acpi_namespace_node *next_node;
ACPI_FUNCTION_TRACE_PTR(ns_delete_node, node); ACPI_FUNCTION_TRACE_PTR(ns_remove_node, node);
parent_node = acpi_ns_get_parent_node(node); parent_node = acpi_ns_get_parent_node(node);
...@@ -142,12 +193,9 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node) ...@@ -142,12 +193,9 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node)
} }
} }
ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++); /* Delete the node and any attached objects */
/* Detach an object if there is one, then delete the node */
acpi_ns_detach_object(node); acpi_ns_delete_node(node);
(void)acpi_os_release_object(acpi_gbl_namespace_cache, node);
return_VOID; return_VOID;
} }
...@@ -273,25 +321,11 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) ...@@ -273,25 +321,11 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)
parent_node, child_node)); parent_node, child_node));
} }
/* Now we can free this child object */ /*
* Delete this child node and move on to the next child in the list.
ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++); * No need to unlink the node since we are deleting the entire branch.
*/
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, acpi_ns_delete_node(child_node);
"Object %p, Remaining %X\n", child_node,
acpi_gbl_current_node_count));
/* Detach an object if there is one, then free the child node */
acpi_ns_detach_object(child_node);
/* Now we can delete the node */
(void)acpi_os_release_object(acpi_gbl_namespace_cache,
child_node);
/* And move on to the next child in the list */
child_node = next_node; child_node = next_node;
} while (!(flags & ANOBJ_END_OF_PEER_LIST)); } while (!(flags & ANOBJ_END_OF_PEER_LIST));
...@@ -433,7 +467,7 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id) ...@@ -433,7 +467,7 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id)
if (deletion_node) { if (deletion_node) {
acpi_ns_delete_children(deletion_node); acpi_ns_delete_children(deletion_node);
acpi_ns_delete_node(deletion_node); acpi_ns_remove_node(deletion_node);
deletion_node = NULL; deletion_node = NULL;
} }
......
...@@ -270,8 +270,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle) ...@@ -270,8 +270,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle)
/* Now delete the starting object, and we are done */ /* Now delete the starting object, and we are done */
acpi_ns_delete_node(child_handle); acpi_ns_remove_node(child_handle);
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
} }
......
...@@ -141,7 +141,7 @@ int acpi_bus_get_status(struct acpi_device *device) ...@@ -141,7 +141,7 @@ int acpi_bus_get_status(struct acpi_device *device)
EXPORT_SYMBOL(acpi_bus_get_status); EXPORT_SYMBOL(acpi_bus_get_status);
void acpi_bus_private_data_handler(acpi_handle handle, void acpi_bus_private_data_handler(acpi_handle handle,
u32 function, void *context) void *context)
{ {
return; return;
} }
......
...@@ -119,7 +119,7 @@ EXPORT_SYMBOL(acpi_get_child); ...@@ -119,7 +119,7 @@ EXPORT_SYMBOL(acpi_get_child);
/* Link ACPI devices with physical devices */ /* Link ACPI devices with physical devices */
static void acpi_glue_data_handler(acpi_handle handle, static void acpi_glue_data_handler(acpi_handle handle,
u32 function, void *context) void *context)
{ {
/* we provide an empty handler */ /* we provide an empty handler */
} }
......
...@@ -687,7 +687,7 @@ acpi_bus_get_ejd(acpi_handle handle, acpi_handle *ejd) ...@@ -687,7 +687,7 @@ acpi_bus_get_ejd(acpi_handle handle, acpi_handle *ejd)
} }
EXPORT_SYMBOL_GPL(acpi_bus_get_ejd); EXPORT_SYMBOL_GPL(acpi_bus_get_ejd);
void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context) void acpi_bus_data_handler(acpi_handle handle, void *context)
{ {
/* TBD */ /* TBD */
......
...@@ -312,7 +312,7 @@ struct acpi_bus_event { ...@@ -312,7 +312,7 @@ struct acpi_bus_event {
extern struct kobject *acpi_kobj; extern struct kobject *acpi_kobj;
extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int); extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int);
void acpi_bus_private_data_handler(acpi_handle, u32, void *); void acpi_bus_private_data_handler(acpi_handle, void *);
int acpi_bus_get_private_data(acpi_handle, void **); int acpi_bus_get_private_data(acpi_handle, void **);
extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32); extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32);
extern int register_acpi_notifier(struct notifier_block *); extern int register_acpi_notifier(struct notifier_block *);
...@@ -325,7 +325,7 @@ extern void unregister_acpi_bus_notifier(struct notifier_block *nb); ...@@ -325,7 +325,7 @@ extern void unregister_acpi_bus_notifier(struct notifier_block *nb);
*/ */
int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device); int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device);
void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context); void acpi_bus_data_handler(acpi_handle handle, void *context);
int acpi_bus_get_status(struct acpi_device *device); int acpi_bus_get_status(struct acpi_device *device);
int acpi_bus_get_power(acpi_handle handle, int *state); int acpi_bus_get_power(acpi_handle handle, int *state);
int acpi_bus_set_power(acpi_handle handle, int state); int acpi_bus_set_power(acpi_handle handle, int state);
......
...@@ -922,7 +922,7 @@ typedef ...@@ -922,7 +922,7 @@ typedef
void (*acpi_notify_handler) (acpi_handle device, u32 value, void *context); void (*acpi_notify_handler) (acpi_handle device, u32 value, void *context);
typedef typedef
void (*acpi_object_handler) (acpi_handle object, u32 function, void *data); void (*acpi_object_handler) (acpi_handle object, void *data);
typedef acpi_status(*acpi_init_handler) (acpi_handle object, u32 function); typedef acpi_status(*acpi_init_handler) (acpi_handle object, u32 function);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册