Skip to contentSkip to conversation

cpufreq : cppc: Break out if we match the HiSilicon cppc workaround

PATCH In review Hanjun Guo 2 participants 4 messages Dec 24, 2019 – Dec 30, 2019

Subsystems (3)
lore
Share & tools
lore

Hanjun Guo

author
#0 lore raw

PATCH 1/2 cpufreq : cppc: Break out if we match the HiSilicon cppc workaround

Bail out if we match the OEM information, to save some possible extra iteration. And update the code to fix minor coding style issue.

---
 drivers/cpufreq/cppc_cpufreq.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/cpufreq/cppc_cpufreq.c +4 -2
index 8d8da76..d0ca300 100644
@@ -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;
+		}
 	}
 }
 
Signature · 1 line
1.7.12.4
author
#1 lore raw

PATCH 2/2 cpufreq: cppc: put the acpi table after successfully get it

We need to put the ACPI table to release the table mapping after we successfully get it.

---
 drivers/cpufreq/cppc_cpufreq.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/cpufreq/cppc_cpufreq.c +2 -0
index d0ca300..a06777c 100644
@@ -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 */
Signature · 1 line
1.7.12.4
#2 lore raw
In reply to Hanjun Guo
Quoted 24 lines · CET Hanjun Guo

Bail out if we match the OEM information, to save some possible extra iteration. And update the code to fix minor coding style issue.

---
 drivers/cpufreq/cppc_cpufreq.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/cpufreq/cppc_cpufreq.c +1 -1
index 8d8da76..d0ca300 100644
@@ -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++) {

drivers/cpufreq/cppc_cpufreq.c static void cppc_check_hisi_workaround(void) · line 102

Quoted 10 lines
drivers/cpufreq/cppc_cpufreq.c +3 -1
 		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;
+		}
 	}
 }
 

Both this and the [2/2] applies as 5.6 material with reworked subjects and changelog changes. Thanks!

author
#3 lore raw
Quoted 30 lines · Rafael J. Wysocki
Quoted 29 lines · CET Hanjun Guo

Bail out if we match the OEM information, to save some possible extra iteration. And update the code to fix minor coding style issue.

---
 drivers/cpufreq/cppc_cpufreq.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/cpufreq/cppc_cpufreq.c +3 -2
index 8d8da76..d0ca300 100644
@@ -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;
Quoted 8 lines

drivers/cpufreq/cppc_cpufreq.c static void cppc_check_hisi_workaround(void) · line 102

Quoted 5 lines
drivers/cpufreq/cppc_cpufreq.c +1 -0
+		}
 	}
 }
 

Both this and the [2/2] applies as 5.6 material with reworked subjects and changelog changes. Thanks!

Much better for the reworked subject and changelog, thank you very much!

Hanjun