mirror of https://github.com/ipxe/ipxe.git
[linux] Free cached ACPI tables on shutdown
Free any cached ACPI tables for the sake of neatness (and a clean report from Valgrind). Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/310/head
parent
3a58400121
commit
976839ae4c
|
@ -25,6 +25,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
||||||
#include <ipxe/linux_api.h>
|
#include <ipxe/linux_api.h>
|
||||||
#include <ipxe/linux.h>
|
#include <ipxe/linux.h>
|
||||||
#include <ipxe/list.h>
|
#include <ipxe/list.h>
|
||||||
|
#include <ipxe/init.h>
|
||||||
#include <ipxe/acpi.h>
|
#include <ipxe/acpi.h>
|
||||||
|
|
||||||
/** ACPI sysfs directory */
|
/** ACPI sysfs directory */
|
||||||
|
@ -170,4 +171,25 @@ static userptr_t linux_acpi_find ( uint32_t signature, unsigned int index ) {
|
||||||
return UNULL;
|
return UNULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free cached ACPI data
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static void linux_acpi_shutdown ( int booting __unused ) {
|
||||||
|
struct linux_acpi_table *table;
|
||||||
|
struct linux_acpi_table *tmp;
|
||||||
|
|
||||||
|
list_for_each_entry_safe ( table, tmp, &linux_acpi_tables, list ) {
|
||||||
|
list_del ( &table->list );
|
||||||
|
free ( table->data );
|
||||||
|
free ( table );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** ACPI shutdown function */
|
||||||
|
struct startup_fn linux_acpi_startup_fn __startup_fn ( STARTUP_NORMAL ) = {
|
||||||
|
.name = "linux_acpi",
|
||||||
|
.shutdown = linux_acpi_shutdown,
|
||||||
|
};
|
||||||
|
|
||||||
PROVIDE_ACPI ( linux, acpi_find, linux_acpi_find );
|
PROVIDE_ACPI ( linux, acpi_find, linux_acpi_find );
|
||||||
|
|
Loading…
Reference in New Issue