summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2017-07-10 03:23:28 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-07-20 10:38:24 -0400
commit9b019b0f67bf527d6412de0497702026ff37e8a6 (patch)
treec95b534d83bb07a80c8b9e93396e685c1dafc4f8
parent96d07940623a2a40b2eec01daebf93bbaaee8a3b (diff)
ACPICA: Tables: Cleanup table handler invokers
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>
-rw-r--r--drivers/acpi/acpica/actables.h2
-rw-r--r--drivers/acpi/acpica/tbdata.c43
-rw-r--r--drivers/acpi/acpica/tbinstal.c8
3 files changed, 33 insertions, 20 deletions
diff --git a/drivers/acpi/acpica/actables.h b/drivers/acpi/acpica/actables.h
index c8da453bd960..89ed31b0f739 100644
--- a/drivers/acpi/acpica/actables.h
+++ b/drivers/acpi/acpica/actables.h
@@ -132,6 +132,8 @@ acpi_tb_install_and_load_table(acpi_physical_address address,
132 132
133acpi_status acpi_tb_unload_table(u32 table_index); 133acpi_status acpi_tb_unload_table(u32 table_index);
134 134
135void acpi_tb_notify_table(u32 event, void *table);
136
135void acpi_tb_terminate(void); 137void acpi_tb_terminate(void);
136 138
137acpi_status acpi_tb_delete_namespace_by_owner(u32 table_index); 139acpi_status acpi_tb_delete_namespace_by_owner(u32 table_index);
diff --git a/drivers/acpi/acpica/tbdata.c b/drivers/acpi/acpica/tbdata.c
index c9d6fa6d7cc6..7056ca01e875 100644
--- a/drivers/acpi/acpica/tbdata.c
+++ b/drivers/acpi/acpica/tbdata.c
@@ -818,13 +818,9 @@ acpi_tb_load_table(u32 table_index, struct acpi_namespace_node *parent_node)
818 acpi_ev_update_gpes(owner_id); 818 acpi_ev_update_gpes(owner_id);
819 } 819 }
820 820
821 /* Invoke table handler if present */ 821 /* Invoke table handler */
822
823 if (acpi_gbl_table_handler) {
824 (void)acpi_gbl_table_handler(ACPI_TABLE_EVENT_LOAD, table,
825 acpi_gbl_table_handler_context);
826 }
827 822
823 acpi_tb_notify_table(ACPI_TABLE_EVENT_LOAD, table);
828 return_ACPI_STATUS(status); 824 return_ACPI_STATUS(status);
829} 825}
830 826
@@ -894,15 +890,11 @@ acpi_status acpi_tb_unload_table(u32 table_index)
894 return_ACPI_STATUS(AE_NOT_EXIST); 890 return_ACPI_STATUS(AE_NOT_EXIST);
895 } 891 }
896 892
897 /* Invoke table handler if present */ 893 /* Invoke table handler */
898 894
899 if (acpi_gbl_table_handler) { 895 status = acpi_get_table_by_index(table_index, &table);
900 status = acpi_get_table_by_index(table_index, &table); 896 if (ACPI_SUCCESS(status)) {
901 if (ACPI_SUCCESS(status)) { 897 acpi_tb_notify_table(ACPI_TABLE_EVENT_UNLOAD, table);
902 (void)acpi_gbl_table_handler(ACPI_TABLE_EVENT_UNLOAD,
903 table,
904 acpi_gbl_table_handler_context);
905 }
906 } 898 }
907 899
908 /* Delete the portion of the namespace owned by this table */ 900 /* Delete the portion of the namespace owned by this table */
@@ -918,3 +910,26 @@ acpi_status acpi_tb_unload_table(u32 table_index)
918} 910}
919 911
920ACPI_EXPORT_SYMBOL(acpi_tb_unload_table) 912ACPI_EXPORT_SYMBOL(acpi_tb_unload_table)
913
914/*******************************************************************************
915 *
916 * FUNCTION: acpi_tb_notify_table
917 *
918 * PARAMETERS: event - Table event
919 * table - Validated table pointer
920 *
921 * RETURN: None
922 *
923 * DESCRIPTION: Notify a table event to the users.
924 *
925 ******************************************************************************/
926
927void acpi_tb_notify_table(u32 event, void *table)
928{
929 /* Invoke table handler if present */
930
931 if (acpi_gbl_table_handler) {
932 (void)acpi_gbl_table_handler(event, table,
933 acpi_gbl_table_handler_context);
934 }
935}
diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c
index 4620f3c68c13..ee745152f25b 100644
--- a/drivers/acpi/acpica/tbinstal.c
+++ b/drivers/acpi/acpica/tbinstal.c
@@ -306,14 +306,10 @@ acpi_tb_install_standard_table(acpi_physical_address address,
306 acpi_tb_install_table_with_override(&new_table_desc, override, 306 acpi_tb_install_table_with_override(&new_table_desc, override,
307 table_index); 307 table_index);
308 308
309 /* Invoke table handler if present */ 309 /* Invoke table handler */
310 310
311 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); 311 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
312 if (acpi_gbl_table_handler) { 312 acpi_tb_notify_table(ACPI_TABLE_EVENT_INSTALL, new_table_desc.pointer);
313 (void)acpi_gbl_table_handler(ACPI_TABLE_EVENT_INSTALL,
314 new_table_desc.pointer,
315 acpi_gbl_table_handler_context);
316 }
317 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); 313 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
318 314
319unlock_and_exit: 315unlock_and_exit: