From c740237937c039c06e9cda32b9a37dde8b0d1e63 Mon Sep 17 00:00:00 2001 From: Hanjun Guo Date: Tue, 24 Dec 2019 09:56:29 +0800 Subject: [PATCH 1/2] cpufreq : CPPC: Break out if HiSilicon CPPC workaround is matched Bail out if we match the OEM information, to save some possible extra iteration. Also update the code to fix minor coding style issue. Signed-off-by: Hanjun Guo [ rjw: Subject ] Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/cppc_cpufreq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c index 8d8da763adc5..d0ca3007b4f2 100644 --- a/drivers/cpufreq/cppc_cpufreq.c +++ b/drivers/cpufreq/cppc_cpufreq.c @@ -39,7 +39,7 @@ static struct cppc_cpudata **all_cpu_data; struct cppc_workaround_oem_info { - char oem_id[ACPI_OEM_ID_SIZE +1]; + char oem_id[ACPI_OEM_ID_SIZE + 1]; char oem_table_id[ACPI_OEM_TABLE_ID_SIZE + 1]; u32 oem_revision; }; @@ -93,8 +93,10 @@ static void cppc_check_hisi_workaround(void) for (i = 0; i < ARRAY_SIZE(wa_info); i++) { if (!memcmp(wa_info[i].oem_id, tbl->oem_id, ACPI_OEM_ID_SIZE) && !memcmp(wa_info[i].oem_table_id, tbl->oem_table_id, ACPI_OEM_TABLE_ID_SIZE) && - wa_info[i].oem_revision == tbl->oem_revision) + wa_info[i].oem_revision == tbl->oem_revision) { apply_hisi_workaround = true; + break; + } } } From 80e8b1e59f0399b94a6088bcb9477bd798cc5eba Mon Sep 17 00:00:00 2001 From: Hanjun Guo Date: Tue, 24 Dec 2019 09:56:30 +0800 Subject: [PATCH 2/2] cpufreq: CPPC: put ACPI table after using it Put the ACPI table to release the table mapping after using it successfully. Signed-off-by: Hanjun Guo [ rjw: Subject & changelog ] Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/cppc_cpufreq.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c index d0ca3007b4f2..a06777c35fc0 100644 --- a/drivers/cpufreq/cppc_cpufreq.c +++ b/drivers/cpufreq/cppc_cpufreq.c @@ -98,6 +98,8 @@ static void cppc_check_hisi_workaround(void) break; } } + + acpi_put_table(tbl); } /* Callback function used to retrieve the max frequency from DMI */