Skip to content

Commit

Permalink
Tables: Cleanup table handler invokers
Browse files Browse the repository at this point in the history
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 AcpiGbl_TableHandler. Lv Zheng.

Tested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
  • Loading branch information
Lv Zheng committed Jun 26, 2017
1 parent 8d618db commit 4551f51
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 21 deletions.
49 changes: 34 additions & 15 deletions source/components/tables/tbdata.c
Expand Up @@ -1029,14 +1029,9 @@ AcpiTbLoadTable (
AcpiEvUpdateGpes (OwnerId);
}

/* Invoke table handler if present */

if (AcpiGbl_TableHandler)
{
(void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table,
AcpiGbl_TableHandlerContext);
}
/* Invoke table handler */

AcpiTbNotifyTable (ACPI_TABLE_EVENT_LOAD, Table);
return_ACPI_STATUS (Status);
}

Expand Down Expand Up @@ -1117,16 +1112,12 @@ AcpiTbUnloadTable (
return_ACPI_STATUS (AE_NOT_EXIST);
}

/* Invoke table handler if present */
/* Invoke table handler */

if (AcpiGbl_TableHandler)
Status = AcpiGetTableByIndex (TableIndex, &Table);
if (ACPI_SUCCESS (Status))
{
Status = AcpiGetTableByIndex (TableIndex, &Table);
if (ACPI_SUCCESS (Status))
{
(void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_UNLOAD, Table,
AcpiGbl_TableHandlerContext);
}
AcpiTbNotifyTable (ACPI_TABLE_EVENT_UNLOAD, Table);
}

/* Delete the portion of the namespace owned by this table */
Expand All @@ -1141,3 +1132,31 @@ AcpiTbUnloadTable (
AcpiTbSetTableLoadedFlag (TableIndex, FALSE);
return_ACPI_STATUS (Status);
}


/*******************************************************************************
*
* FUNCTION: AcpiTbNotifyTable
*
* PARAMETERS: Event - Table event
* Table - Validated table pointer
*
* RETURN: None
*
* DESCRIPTION: Notify a table event to the users.
*
******************************************************************************/

void
AcpiTbNotifyTable (
UINT32 Event,
void *Table)
{
/* Invoke table handler if present */

if (AcpiGbl_TableHandler)
{
(void) AcpiGbl_TableHandler (Event, Table,
AcpiGbl_TableHandlerContext);
}
}
8 changes: 2 additions & 6 deletions source/components/tables/tbinstal.c
Expand Up @@ -434,14 +434,10 @@ AcpiTbInstallStandardTable (

AcpiTbInstallTableWithOverride (&NewTableDesc, Override, TableIndex);

/* Invoke table handler if present */
/* Invoke table handler */

(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
if (AcpiGbl_TableHandler)
{
(void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_INSTALL,
NewTableDesc.Pointer, AcpiGbl_TableHandlerContext);
}
AcpiTbNotifyTable (ACPI_TABLE_EVENT_INSTALL, NewTableDesc.Pointer);
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);

UnlockAndExit:
Expand Down
5 changes: 5 additions & 0 deletions source/include/actables.h
Expand Up @@ -302,6 +302,11 @@ ACPI_STATUS
AcpiTbUnloadTable (
UINT32 TableIndex);

void
AcpiTbNotifyTable (
UINT32 Event,
void *Table);

void
AcpiTbTerminate (
void);
Expand Down

0 comments on commit 4551f51

Please sign in to comment.