aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2015-01-26 03:58:48 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-01-26 10:08:49 -0500
commite044d8f92f79db167bb7f9dfd0f317e3238d82d1 (patch)
tree682e368f69212caf930a0c56701eba3f41f71bdd /drivers
parent97d746578b1fc4ce461e6279220cab3605f02469 (diff)
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/acpica/nsxfobj.c44
-rw-r--r--drivers/acpi/acpica/tbxface.c46
-rw-r--r--drivers/pci/hotplug/sgi_hotplug.c13
3 files changed, 7 insertions, 96 deletions
diff --git a/drivers/acpi/acpica/nsxfobj.c b/drivers/acpi/acpica/nsxfobj.c
index dae9401be7a2..51a83298c18d 100644
--- a/drivers/acpi/acpica/nsxfobj.c
+++ b/drivers/acpi/acpica/nsxfobj.c
@@ -53,50 +53,6 @@ ACPI_MODULE_NAME("nsxfobj")
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 ******************************************************************************/
66acpi_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
96ACPI_EXPORT_SYMBOL(acpi_get_id)
97
98/*******************************************************************************
99 *
100 * FUNCTION: acpi_get_type 56 * FUNCTION: acpi_get_type
101 * 57 *
102 * PARAMETERS: handle - Handle of object whose type is desired 58 * PARAMETERS: handle - Handle of object whose type is desired
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c
index 9520ae19bb37..0f9dd80b1cdd 100644
--- a/drivers/acpi/acpica/tbxface.c
+++ b/drivers/acpi/acpica/tbxface.c
@@ -265,52 +265,6 @@ ACPI_EXPORT_SYMBOL(acpi_get_table_header)
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 ******************************************************************************/
277acpi_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
310ACPI_EXPORT_SYMBOL(acpi_unload_table_id)
311
312/*******************************************************************************
313 *
314 * FUNCTION: acpi_get_table_with_size 268 * FUNCTION: acpi_get_table_with_size
315 * 269 *
316 * PARAMETERS: signature - ACPI signature of needed table 270 * PARAMETERS: signature - ACPI signature of needed table
diff --git a/drivers/pci/hotplug/sgi_hotplug.c b/drivers/pci/hotplug/sgi_hotplug.c
index bada20999870..c32fb786d48e 100644
--- a/drivers/pci/hotplug/sgi_hotplug.c
+++ b/drivers/pci/hotplug/sgi_hotplug.c
@@ -475,7 +475,7 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot)
475 struct slot *slot = bss_hotplug_slot->private; 475 struct slot *slot = bss_hotplug_slot->private;
476 struct pci_dev *dev, *temp; 476 struct pci_dev *dev, *temp;
477 int rc; 477 int rc;
478 acpi_owner_id ssdt_id = 0; 478 acpi_handle ssdt_hdl = NULL;
479 479
480 /* Acquire update access to the bus */ 480 /* Acquire update access to the bus */
481 mutex_lock(&sn_hotplug_mutex); 481 mutex_lock(&sn_hotplug_mutex);
@@ -522,7 +522,7 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot)
522 if (ACPI_SUCCESS(ret) && 522 if (ACPI_SUCCESS(ret) &&
523 (adr>>16) == (slot->device_num + 1)) { 523 (adr>>16) == (slot->device_num + 1)) {
524 /* retain the owner id */ 524 /* retain the owner id */
525 acpi_get_id(chandle, &ssdt_id); 525 ssdt_hdl = chandle;
526 526
527 ret = acpi_bus_get_device(chandle, 527 ret = acpi_bus_get_device(chandle,
528 &device); 528 &device);
@@ -547,12 +547,13 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot)
547 pci_unlock_rescan_remove(); 547 pci_unlock_rescan_remove();
548 548
549 /* Remove the SSDT for the slot from the ACPI namespace */ 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 acpi_status ret; 551 acpi_status ret;
552 ret = acpi_unload_table_id(ssdt_id); 552 ret = acpi_unload_parent_table(ssdt_hdl);
553 if (ACPI_FAILURE(ret)) { 553 if (ACPI_FAILURE(ret)) {
554 printk(KERN_ERR "%s: acpi_unload_table_id failed (0x%x) for id %d\n", 554 acpi_handle_err(ssdt_hdl,
555 __func__, ret, ssdt_id); 555 "%s: acpi_unload_parent_table failed (0x%x)\n",
556 __func__, ret);
556 /* try to continue on */ 557 /* try to continue on */
557 } 558 }
558 } 559 }