mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 04:01:48 -04:00
ACPI / osl: Remove acpi_get_table_with_size()/early_acpi_os_unmap_memory() users
This patch removes the users of the deprectated APIs: acpi_get_table_with_size() early_acpi_os_unmap_memory() The following APIs should be used instead of: acpi_get_table() acpi_put_table() The deprecated APIs are invented to be a replacement of acpi_get_table() during the early stage so that the early mapped pointer will not be stored in ACPICA core and thus the late stage acpi_get_table() won't return a wrong pointer. The mapping size is returned just because it is required by early_acpi_os_unmap_memory() to unmap the pointer during early stage. But as the mapping size equals to the acpi_table_header.length (see acpi_tb_init_table_descriptor() and acpi_tb_validate_table()), when such a convenient result is returned, driver code will start to use it instead of accessing acpi_table_header to obtain the length. Thus this patch cleans up the drivers by replacing returned table size with acpi_table_header.length, and should be a no-op. Reported-by: Dan Williams <[email protected]> Signed-off-by: Lv Zheng <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
This commit is contained in:
parent
66360faa43
commit
6b11d1d677
10 changed files with 29 additions and 42 deletions
|
|
@ -2781,12 +2781,13 @@ static int acpi_nfit_add(struct acpi_device *adev)
|
|||
acpi_size sz;
|
||||
int rc = 0;
|
||||
|
||||
status = acpi_get_table_with_size(ACPI_SIG_NFIT, 0, &tbl, &sz);
|
||||
status = acpi_get_table(ACPI_SIG_NFIT, 0, &tbl);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
/* This is ok, we could have an nvdimm hotplugged later */
|
||||
dev_dbg(dev, "failed to find NFIT at startup\n");
|
||||
return 0;
|
||||
}
|
||||
sz = tbl->length;
|
||||
|
||||
acpi_desc = devm_kzalloc(dev, sizeof(*acpi_desc), GFP_KERNEL);
|
||||
if (!acpi_desc)
|
||||
|
|
|
|||
|
|
@ -154,18 +154,16 @@ static phys_cpuid_t map_madt_entry(struct acpi_table_madt *madt,
|
|||
phys_cpuid_t __init acpi_map_madt_entry(u32 acpi_id)
|
||||
{
|
||||
struct acpi_table_madt *madt = NULL;
|
||||
acpi_size tbl_size;
|
||||
phys_cpuid_t rv;
|
||||
|
||||
acpi_get_table_with_size(ACPI_SIG_MADT, 0,
|
||||
(struct acpi_table_header **)&madt,
|
||||
&tbl_size);
|
||||
acpi_get_table(ACPI_SIG_MADT, 0,
|
||||
(struct acpi_table_header **)&madt);
|
||||
if (!madt)
|
||||
return PHYS_CPUID_INVALID;
|
||||
|
||||
rv = map_madt_entry(madt, 1, acpi_id, true);
|
||||
|
||||
early_acpi_os_unmap_memory(madt, tbl_size);
|
||||
acpi_put_table((struct acpi_table_header *)madt);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ int __init parse_spcr(bool earlycon)
|
|||
{
|
||||
static char opts[64];
|
||||
struct acpi_table_spcr *table;
|
||||
acpi_size table_size;
|
||||
acpi_status status;
|
||||
char *uart;
|
||||
char *iotype;
|
||||
|
|
@ -43,9 +42,8 @@ int __init parse_spcr(bool earlycon)
|
|||
if (acpi_disabled)
|
||||
return -ENODEV;
|
||||
|
||||
status = acpi_get_table_with_size(ACPI_SIG_SPCR, 0,
|
||||
(struct acpi_table_header **)&table,
|
||||
&table_size);
|
||||
status = acpi_get_table(ACPI_SIG_SPCR, 0,
|
||||
(struct acpi_table_header **)&table);
|
||||
|
||||
if (ACPI_FAILURE(status))
|
||||
return -ENOENT;
|
||||
|
|
@ -106,6 +104,6 @@ int __init parse_spcr(bool earlycon)
|
|||
err = add_preferred_console(uart, 0, opts + strlen(uart) + 1);
|
||||
|
||||
done:
|
||||
early_acpi_os_unmap_memory((void __iomem *)table, table_size);
|
||||
acpi_put_table((struct acpi_table_header *)table);
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -333,7 +333,6 @@ acpi_table_parse_entries_array(char *id,
|
|||
unsigned int max_entries)
|
||||
{
|
||||
struct acpi_table_header *table_header = NULL;
|
||||
acpi_size tbl_size;
|
||||
int count;
|
||||
u32 instance = 0;
|
||||
|
||||
|
|
@ -346,7 +345,7 @@ acpi_table_parse_entries_array(char *id,
|
|||
if (!strncmp(id, ACPI_SIG_MADT, 4))
|
||||
instance = acpi_apic_instance;
|
||||
|
||||
acpi_get_table_with_size(id, instance, &table_header, &tbl_size);
|
||||
acpi_get_table(id, instance, &table_header);
|
||||
if (!table_header) {
|
||||
pr_warn("%4.4s not present\n", id);
|
||||
return -ENODEV;
|
||||
|
|
@ -355,7 +354,7 @@ acpi_table_parse_entries_array(char *id,
|
|||
count = acpi_parse_entries_array(id, table_size, table_header,
|
||||
proc, proc_num, max_entries);
|
||||
|
||||
early_acpi_os_unmap_memory((char *)table_header, tbl_size);
|
||||
acpi_put_table(table_header);
|
||||
return count;
|
||||
}
|
||||
|
||||
|
|
@ -397,7 +396,6 @@ acpi_table_parse_madt(enum acpi_madt_type id,
|
|||
int __init acpi_table_parse(char *id, acpi_tbl_table_handler handler)
|
||||
{
|
||||
struct acpi_table_header *table = NULL;
|
||||
acpi_size tbl_size;
|
||||
|
||||
if (acpi_disabled)
|
||||
return -ENODEV;
|
||||
|
|
@ -406,13 +404,13 @@ int __init acpi_table_parse(char *id, acpi_tbl_table_handler handler)
|
|||
return -EINVAL;
|
||||
|
||||
if (strncmp(id, ACPI_SIG_MADT, 4) == 0)
|
||||
acpi_get_table_with_size(id, acpi_apic_instance, &table, &tbl_size);
|
||||
acpi_get_table(id, acpi_apic_instance, &table);
|
||||
else
|
||||
acpi_get_table_with_size(id, 0, &table, &tbl_size);
|
||||
acpi_get_table(id, 0, &table);
|
||||
|
||||
if (table) {
|
||||
handler(table);
|
||||
early_acpi_os_unmap_memory(table, tbl_size);
|
||||
acpi_put_table(table);
|
||||
return 0;
|
||||
} else
|
||||
return -ENODEV;
|
||||
|
|
@ -426,16 +424,15 @@ int __init acpi_table_parse(char *id, acpi_tbl_table_handler handler)
|
|||
static void __init check_multiple_madt(void)
|
||||
{
|
||||
struct acpi_table_header *table = NULL;
|
||||
acpi_size tbl_size;
|
||||
|
||||
acpi_get_table_with_size(ACPI_SIG_MADT, 2, &table, &tbl_size);
|
||||
acpi_get_table(ACPI_SIG_MADT, 2, &table);
|
||||
if (table) {
|
||||
pr_warn("BIOS bug: multiple APIC/MADT found, using %d\n",
|
||||
acpi_apic_instance);
|
||||
pr_warn("If \"acpi_apic_instance=%d\" works better, "
|
||||
"notify [email protected]\n",
|
||||
acpi_apic_instance ? 0 : 2);
|
||||
early_acpi_os_unmap_memory(table, tbl_size);
|
||||
acpi_put_table(table);
|
||||
|
||||
} else
|
||||
acpi_apic_instance = 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue