Skip to content

Commit e044d8f

Browse files
Lv Zhengrafaeljw
authored andcommitted
ACPI: Introduce acpi_unload_parent_table() usages in Linux kernel
ACPICA has implemented acpi_unload_parent_table() which can exactly replace the acpi_get_id()/acpi_unload_table_id() implemented in Linux kernel. The acpi_unload_parent_table() has been unit tested in ACPICA simulation environment. This patch can also help to reduce the source code differences between Linux and ACPICA. Signed-off-by: Lv Zheng <lv.zheng@intel.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com> Tested-by: Octavian Purdila <octavian.purdila@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 97d7465 commit e044d8f

4 files changed

Lines changed: 7 additions & 102 deletions

File tree

‎drivers/acpi/acpica/nsxfobj.c‎

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -51,50 +51,6 @@
5151
#define _COMPONENT ACPI_NAMESPACE
5252
ACPI_MODULE_NAME("nsxfobj")
5353

54-
/*******************************************************************************
55-
*
56-
* FUNCTION: acpi_get_id
57-
*
58-
* PARAMETERS: Handle - Handle of object whose id is desired
59-
* ret_id - Where the id will be placed
60-
*
61-
* RETURN: Status
62-
*
63-
* DESCRIPTION: This routine returns the owner id associated with a handle
64-
*
65-
******************************************************************************/
66-
acpi_status acpi_get_id(acpi_handle handle, acpi_owner_id * ret_id)
67-
{
68-
struct acpi_namespace_node *node;
69-
acpi_status status;
70-
71-
/* Parameter Validation */
72-
73-
if (!ret_id) {
74-
return (AE_BAD_PARAMETER);
75-
}
76-
77-
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
78-
if (ACPI_FAILURE(status)) {
79-
return (status);
80-
}
81-
82-
/* Convert and validate the handle */
83-
84-
node = acpi_ns_validate_handle(handle);
85-
if (!node) {
86-
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
87-
return (AE_BAD_PARAMETER);
88-
}
89-
90-
*ret_id = node->owner_id;
91-
92-
status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
93-
return (status);
94-
}
95-
96-
ACPI_EXPORT_SYMBOL(acpi_get_id)
97-
9854
/*******************************************************************************
9955
*
10056
* FUNCTION: acpi_get_type

‎drivers/acpi/acpica/tbxface.c‎

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -263,52 +263,6 @@ acpi_get_table_header(char *signature,
263263

264264
ACPI_EXPORT_SYMBOL(acpi_get_table_header)
265265

266-
/*******************************************************************************
267-
*
268-
* FUNCTION: acpi_unload_table_id
269-
*
270-
* PARAMETERS: id - Owner ID of the table to be removed.
271-
*
272-
* RETURN: Status
273-
*
274-
* DESCRIPTION: This routine is used to force the unload of a table (by id)
275-
*
276-
******************************************************************************/
277-
acpi_status acpi_unload_table_id(acpi_owner_id id)
278-
{
279-
int i;
280-
acpi_status status = AE_NOT_EXIST;
281-
282-
ACPI_FUNCTION_TRACE(acpi_unload_table_id);
283-
284-
status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER);
285-
if (ACPI_FAILURE(status)) {
286-
return_ACPI_STATUS(status);
287-
}
288-
289-
/* Find table in the global table list */
290-
for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) {
291-
if (id != acpi_gbl_root_table_list.tables[i].owner_id) {
292-
continue;
293-
}
294-
/*
295-
* Delete all namespace objects owned by this table. Note that these
296-
* objects can appear anywhere in the namespace by virtue of the AML
297-
* "Scope" operator. Thus, we need to track ownership by an ID, not
298-
* simply a position within the hierarchy
299-
*/
300-
acpi_tb_delete_namespace_by_owner(i);
301-
status = acpi_tb_release_owner_id(i);
302-
acpi_tb_set_table_loaded_flag(i, FALSE);
303-
break;
304-
}
305-
306-
(void)acpi_ut_release_mutex(ACPI_MTX_INTERPRETER);
307-
return_ACPI_STATUS(status);
308-
}
309-
310-
ACPI_EXPORT_SYMBOL(acpi_unload_table_id)
311-
312266
/*******************************************************************************
313267
*
314268
* FUNCTION: acpi_get_table_with_size

‎drivers/pci/hotplug/sgi_hotplug.c‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot)
475475
struct slot *slot = bss_hotplug_slot->private;
476476
struct pci_dev *dev, *temp;
477477
int rc;
478-
acpi_owner_id ssdt_id = 0;
478+
acpi_handle ssdt_hdl = NULL;
479479

480480
/* Acquire update access to the bus */
481481
mutex_lock(&sn_hotplug_mutex);
@@ -522,7 +522,7 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot)
522522
if (ACPI_SUCCESS(ret) &&
523523
(adr>>16) == (slot->device_num + 1)) {
524524
/* retain the owner id */
525-
acpi_get_id(chandle, &ssdt_id);
525+
ssdt_hdl = chandle;
526526

527527
ret = acpi_bus_get_device(chandle,
528528
&device);
@@ -547,12 +547,13 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot)
547547
pci_unlock_rescan_remove();
548548

549549
/* Remove the SSDT for the slot from the ACPI namespace */
550-
if (SN_ACPI_BASE_SUPPORT() && ssdt_id) {
550+
if (SN_ACPI_BASE_SUPPORT() && ssdt_hdl) {
551551
acpi_status ret;
552-
ret = acpi_unload_table_id(ssdt_id);
552+
ret = acpi_unload_parent_table(ssdt_hdl);
553553
if (ACPI_FAILURE(ret)) {
554-
printk(KERN_ERR "%s: acpi_unload_table_id failed (0x%x) for id %d\n",
555-
__func__, ret, ssdt_id);
554+
acpi_handle_err(ssdt_hdl,
555+
"%s: acpi_unload_parent_table failed (0x%x)\n",
556+
__func__, ret);
556557
/* try to continue on */
557558
}
558559
}

‎include/acpi/acpixf.h‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -890,12 +890,6 @@ ACPI_APP_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(1)
890890
*/
891891
ACPI_GLOBAL(u8, acpi_gbl_permanent_mmap);
892892

893-
ACPI_EXTERNAL_RETURN_STATUS(acpi_status
894-
acpi_get_id(acpi_handle object,
895-
acpi_owner_id * out_type))
896-
897-
ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_unload_table_id(acpi_owner_id id))
898-
899893
ACPI_EXTERNAL_RETURN_STATUS(acpi_status
900894
acpi_get_table_with_size(acpi_string signature,
901895
u32 instance,

0 commit comments

Comments
 (0)