[PATCH] ACPI: processor: idle: Simplify acpi_processor_get_cstate_info() logic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since commit 496121c02127 ("ACPI: processor: idle: Allow probing on
platforms with one ACPI C-state"), acpi_idle driver can be probed with
C1 only.

Optimize the logic for setting pr->power.count and pr->flags.power by
1. unconditionally set pr->flags.power leveraging the fact that C1 is
   always valid after acpi_processor_get_power_info_default().
2. update acpi_processor_power_verify() to return the highest valid
   C-state directly.

No functional change intended.

Signed-off-by: Zhang Rui <rui.zhang@xxxxxxxxx>
---
 drivers/acpi/processor_idle.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 698897b29de2..7ce8c3802937 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -442,7 +442,7 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)
 
 		lapic_timer_check_state(i, pr, cx);
 		tsc_check_state(cx->type);
-		working++;
+		working = i;
 	}
 
 	if (buggy_latency) {
@@ -457,7 +457,6 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)
 
 static int acpi_processor_get_cstate_info(struct acpi_processor *pr)
 {
-	unsigned int i;
 	int result;
 
 
@@ -477,17 +476,7 @@ static int acpi_processor_get_cstate_info(struct acpi_processor *pr)
 	acpi_processor_get_power_info_default(pr);
 
 	pr->power.count = acpi_processor_power_verify(pr);
-
-	/*
-	 * if one state of type C2 or C3 is available, mark this
-	 * CPU as being "idle manageable"
-	 */
-	for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
-		if (pr->power.states[i].valid) {
-			pr->power.count = i;
-			pr->flags.power = 1;
-		}
-	}
+	pr->flags.power = 1;
 
 	return 0;
 }
-- 
2.43.0






[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux