Skip to content

Commit 1770093

Browse files
Nikolaus Vossrafaeljw
authored andcommitted
ACPICA: make acpi_load_table() return table index
ACPICA commit d1716a829d19be23277d9157c575a03b9abb7457 For unloading an ACPI table, it is necessary to provide the index of the table. The method intended for dynamically loading or hotplug addition of tables, acpi_load_table(), should provide this information via an optional pointer to the loaded table index. This patch fixes the table unload function of acpi_configfs. Reported-by: Andy Shevchenko <[email protected]> Fixes: d06c47e ("ACPI: configfs: Resolve objects on host-directed table loads") Link: acpica/acpica@d1716a82 Signed-off-by: Nikolaus Voss <[email protected]> Signed-off-by: Erik Schmauss <[email protected]> Signed-off-by: Bob Moore <[email protected]> Tested-by: Andy Shevchenko <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 42d939f commit 1770093

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

drivers/acpi/acpi_configfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static ssize_t acpi_table_aml_write(struct config_item *cfg,
5353
if (!table->header)
5454
return -ENOMEM;
5555

56-
ret = acpi_load_table(table->header);
56+
ret = acpi_load_table(table->header, &table->index);
5757
if (ret) {
5858
kfree(table->header);
5959
table->header = NULL;
@@ -223,7 +223,7 @@ static void acpi_table_drop_item(struct config_group *group,
223223
struct acpi_table *table = container_of(cfg, struct acpi_table, cfg);
224224

225225
ACPI_INFO(("Host-directed Dynamic ACPI Table Unload"));
226-
acpi_tb_unload_table(table->index);
226+
acpi_unload_table(table->index);
227227
}
228228

229229
static struct configfs_group_operations acpi_table_group_ops = {

drivers/acpi/acpica/dbfileio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ acpi_status acpi_db_load_tables(struct acpi_new_table_desc *list_head)
9393
while (table_list_head) {
9494
table = table_list_head->table;
9595

96-
status = acpi_load_table(table);
96+
status = acpi_load_table(table, NULL);
9797
if (ACPI_FAILURE(status)) {
9898
if (status == AE_ALREADY_EXISTS) {
9999
acpi_os_printf

drivers/acpi/acpica/tbxfload.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,8 @@ ACPI_EXPORT_SYMBOL_INIT(acpi_install_table)
268268
*
269269
* PARAMETERS: table - Pointer to a buffer containing the ACPI
270270
* table to be loaded.
271+
* table_idx - Pointer to a u32 for storing the table
272+
* index, might be NULL
271273
*
272274
* RETURN: Status
273275
*
@@ -278,7 +280,7 @@ ACPI_EXPORT_SYMBOL_INIT(acpi_install_table)
278280
* to ensure that the table is not deleted or unmapped.
279281
*
280282
******************************************************************************/
281-
acpi_status acpi_load_table(struct acpi_table_header *table)
283+
acpi_status acpi_load_table(struct acpi_table_header *table, u32 *table_idx)
282284
{
283285
acpi_status status;
284286
u32 table_index;
@@ -297,6 +299,10 @@ acpi_status acpi_load_table(struct acpi_table_header *table)
297299
status = acpi_tb_install_and_load_table(ACPI_PTR_TO_PHYSADDR(table),
298300
ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL,
299301
FALSE, &table_index);
302+
if (table_idx) {
303+
*table_idx = table_index;
304+
}
305+
300306
if (ACPI_SUCCESS(status)) {
301307

302308
/* Complete the initialization/resolution of new objects */

drivers/firmware/efi/efi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ static __init int efivar_ssdt_load(void)
296296
goto free_data;
297297
}
298298

299-
ret = acpi_load_table(data);
299+
ret = acpi_load_table(data, NULL);
300300
if (ret) {
301301
pr_err("failed to load table: %d\n", ret);
302302
goto free_data;

include/acpi/acpixf.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,8 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION
458458
u8 physical))
459459

460460
ACPI_EXTERNAL_RETURN_STATUS(acpi_status
461-
acpi_load_table(struct acpi_table_header *table))
461+
acpi_load_table(struct acpi_table_header *table,
462+
u32 *table_idx))
462463

463464
ACPI_EXTERNAL_RETURN_STATUS(acpi_status
464465
acpi_unload_table(u32 table_index))

0 commit comments

Comments
 (0)