ACPICA: Tables: Cleanup table handler invokers
authorLv Zheng <lv.zheng@intel.com>
Mon, 10 Jul 2017 07:23:28 +0000 (15:23 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 20 Jul 2017 14:38:24 +0000 (16:38 +0200)
ACPICA commit 4551f51fa8ba33a977721c3b250cb70a309e3f23

Recently, we allows the table mutex to be held in both early and late stage
APIs. This patch further cleans up the related code to reduce redundant
code related to acpi_gbl_table_handler. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/4551f51f
Tested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/acpica/actables.h
drivers/acpi/acpica/tbdata.c
drivers/acpi/acpica/tbinstal.c

index c8da453bd96078fdb9899ffbffbf6a5418d0c281..89ed31b0f739ba3706b4c480c8c6851e676a82da 100644 (file)
@@ -132,6 +132,8 @@ acpi_tb_install_and_load_table(acpi_physical_address address,
 
 acpi_status acpi_tb_unload_table(u32 table_index);
 
+void acpi_tb_notify_table(u32 event, void *table);
+
 void acpi_tb_terminate(void);
 
 acpi_status acpi_tb_delete_namespace_by_owner(u32 table_index);
index c9d6fa6d7cc6f4470589cfc0a54a3d811de04565..7056ca01e875bf8bb5d199cf3d1c0a85eafced6b 100644 (file)
@@ -818,13 +818,9 @@ acpi_tb_load_table(u32 table_index, struct acpi_namespace_node *parent_node)
                acpi_ev_update_gpes(owner_id);
        }
 
-       /* Invoke table handler if present */
-
-       if (acpi_gbl_table_handler) {
-               (void)acpi_gbl_table_handler(ACPI_TABLE_EVENT_LOAD, table,
-                                            acpi_gbl_table_handler_context);
-       }
+       /* Invoke table handler */
 
+       acpi_tb_notify_table(ACPI_TABLE_EVENT_LOAD, table);
        return_ACPI_STATUS(status);
 }
 
@@ -894,15 +890,11 @@ acpi_status acpi_tb_unload_table(u32 table_index)
                return_ACPI_STATUS(AE_NOT_EXIST);
        }
 
-       /* Invoke table handler if present */
+       /* Invoke table handler */
 
-       if (acpi_gbl_table_handler) {
-               status = acpi_get_table_by_index(table_index, &table);
-               if (ACPI_SUCCESS(status)) {
-                       (void)acpi_gbl_table_handler(ACPI_TABLE_EVENT_UNLOAD,
-                                                    table,
-                                                    acpi_gbl_table_handler_context);
-               }
+       status = acpi_get_table_by_index(table_index, &table);
+       if (ACPI_SUCCESS(status)) {
+               acpi_tb_notify_table(ACPI_TABLE_EVENT_UNLOAD, table);
        }
 
        /* Delete the portion of the namespace owned by this table */
@@ -918,3 +910,26 @@ acpi_status acpi_tb_unload_table(u32 table_index)
 }
 
 ACPI_EXPORT_SYMBOL(acpi_tb_unload_table)
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_tb_notify_table
+ *
+ * PARAMETERS:  event               - Table event
+ *              table               - Validated table pointer
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Notify a table event to the users.
+ *
+ ******************************************************************************/
+
+void acpi_tb_notify_table(u32 event, void *table)
+{
+       /* Invoke table handler if present */
+
+       if (acpi_gbl_table_handler) {
+               (void)acpi_gbl_table_handler(event, table,
+                                            acpi_gbl_table_handler_context);
+       }
+}
index 4620f3c68c13d9c653f8ef92ab7a688a404c4b4c..ee745152f25ba131278c99753f20b9d01a102c01 100644 (file)
@@ -306,14 +306,10 @@ acpi_tb_install_standard_table(acpi_physical_address address,
        acpi_tb_install_table_with_override(&new_table_desc, override,
                                            table_index);
 
-       /* Invoke table handler if present */
+       /* Invoke table handler */
 
        (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
-       if (acpi_gbl_table_handler) {
-               (void)acpi_gbl_table_handler(ACPI_TABLE_EVENT_INSTALL,
-                                            new_table_desc.pointer,
-                                            acpi_gbl_table_handler_context);
-       }
+       acpi_tb_notify_table(ACPI_TABLE_EVENT_INSTALL, new_table_desc.pointer);
        (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
 
 unlock_and_exit: