Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Lv Zheng and committed by
Rafael J. Wysocki
e044d8f9 97d74657

+7 -102
-44
drivers/acpi/acpica/nsxfobj.c
··· 53 53 54 54 /******************************************************************************* 55 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 - 98 - /******************************************************************************* 99 - * 100 56 * FUNCTION: acpi_get_type 101 57 * 102 58 * PARAMETERS: handle - Handle of object whose type is desired
-46
drivers/acpi/acpica/tbxface.c
··· 265 265 266 266 /******************************************************************************* 267 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 - 312 - /******************************************************************************* 313 - * 314 268 * FUNCTION: acpi_get_table_with_size 315 269 * 316 270 * PARAMETERS: signature - ACPI signature of needed table
+7 -6
drivers/pci/hotplug/sgi_hotplug.c
··· 475 475 struct slot *slot = bss_hotplug_slot->private; 476 476 struct pci_dev *dev, *temp; 477 477 int rc; 478 - acpi_owner_id ssdt_id = 0; 478 + acpi_handle ssdt_hdl = NULL; 479 479 480 480 /* Acquire update access to the bus */ 481 481 mutex_lock(&sn_hotplug_mutex); ··· 522 522 if (ACPI_SUCCESS(ret) && 523 523 (adr>>16) == (slot->device_num + 1)) { 524 524 /* retain the owner id */ 525 - acpi_get_id(chandle, &ssdt_id); 525 + ssdt_hdl = chandle; 526 526 527 527 ret = acpi_bus_get_device(chandle, 528 528 &device); ··· 547 547 pci_unlock_rescan_remove(); 548 548 549 549 /* 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) { 551 551 acpi_status ret; 552 - ret = acpi_unload_table_id(ssdt_id); 552 + ret = acpi_unload_parent_table(ssdt_hdl); 553 553 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); 556 557 /* try to continue on */ 557 558 } 558 559 }
-6
include/acpi/acpixf.h
··· 891 891 ACPI_GLOBAL(u8, acpi_gbl_permanent_mmap); 892 892 893 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 - 899 - ACPI_EXTERNAL_RETURN_STATUS(acpi_status 900 894 acpi_get_table_with_size(acpi_string signature, 901 895 u32 instance, 902 896 struct acpi_table_header