mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] ACPI: processor: idle: acpi_processor_get_cstate_info() cleanup
@ 2025-04-09  0:50 Zhang Rui
  2025-04-09  0:50 ` [PATCH 1/2] ACPI: processor: idle: Set pr->flags.power unconditionally Zhang Rui
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Zhang Rui @ 2025-04-09  0:50 UTC (permalink / raw)
  To: rafael.j.wysocki; +Cc: ggherdovich, linux-kernel, linux-pm, linux-acpi

This patch series does further cleanups for
acpi_processor_get_cstate_info() on top of
https://lore.kernel.org/all/20250328143040.9348-2-ggherdovich@suse.cz/

thanks,
rui

----------------------------------------------------------------
Zhang Rui (2):
      ACPI: processor: idle: Set pr->flags.power unconditionally
      ACPI: processor: idle: Remove redundant pr->power.count assignment

 drivers/acpi/processor_idle.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] ACPI: processor: idle: Set pr->flags.power unconditionally
  2025-04-09  0:50 [PATCH 0/2] ACPI: processor: idle: acpi_processor_get_cstate_info() cleanup Zhang Rui
@ 2025-04-09  0:50 ` Zhang Rui
  2025-04-09  0:50 ` [PATCH 2/2] ACPI: processor: idle: Remove redundant pr->power.count assignment Zhang Rui
  2025-04-17  7:37 ` [PATCH 0/2] ACPI: processor: idle: acpi_processor_get_cstate_info() cleanup Giovanni Gherdovich
  2 siblings, 0 replies; 4+ messages in thread
From: Zhang Rui @ 2025-04-09  0:50 UTC (permalink / raw)
  To: rafael.j.wysocki; +Cc: ggherdovich, linux-kernel, linux-pm, linux-acpi

acpi_processor_get_power_info_default() ensures that the processor's
ACPI_STATE_C1 state is always valid. Consequently, the pr->flags.power
should be set unconditionally after this.

Remove conditional checks and directly set pr->flags.power.

No functional change.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
 drivers/acpi/processor_idle.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 2a076c7a825a..7264444d56b8 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -481,11 +481,11 @@ 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);
+	pr->flags.power = 1;
 
 	for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
 		if (pr->power.states[i].valid) {
 			pr->power.count = i;
-			pr->flags.power = 1;
 		}
 	}
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] ACPI: processor: idle: Remove redundant pr->power.count assignment
  2025-04-09  0:50 [PATCH 0/2] ACPI: processor: idle: acpi_processor_get_cstate_info() cleanup Zhang Rui
  2025-04-09  0:50 ` [PATCH 1/2] ACPI: processor: idle: Set pr->flags.power unconditionally Zhang Rui
@ 2025-04-09  0:50 ` Zhang Rui
  2025-04-17  7:37 ` [PATCH 0/2] ACPI: processor: idle: acpi_processor_get_cstate_info() cleanup Giovanni Gherdovich
  2 siblings, 0 replies; 4+ messages in thread
From: Zhang Rui @ 2025-04-09  0:50 UTC (permalink / raw)
  To: rafael.j.wysocki; +Cc: ggherdovich, linux-kernel, linux-pm, linux-acpi

pr->power.count stands for the number of valid processor cstates. And it
is correctly set with the return value of acpi_processor_power_verify(),
in acpi_processor_get_cstate_info().

Remove the redundant logic that unnecessarily overrides pr->power.count
value.

No functional change intended.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
 drivers/acpi/processor_idle.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 7264444d56b8..623c415790b0 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -483,12 +483,6 @@ static int acpi_processor_get_cstate_info(struct acpi_processor *pr)
 	pr->power.count = acpi_processor_power_verify(pr);
 	pr->flags.power = 1;
 
-	for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
-		if (pr->power.states[i].valid) {
-			pr->power.count = i;
-		}
-	}
-
 	return 0;
 }
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] ACPI: processor: idle: acpi_processor_get_cstate_info() cleanup
  2025-04-09  0:50 [PATCH 0/2] ACPI: processor: idle: acpi_processor_get_cstate_info() cleanup Zhang Rui
  2025-04-09  0:50 ` [PATCH 1/2] ACPI: processor: idle: Set pr->flags.power unconditionally Zhang Rui
  2025-04-09  0:50 ` [PATCH 2/2] ACPI: processor: idle: Remove redundant pr->power.count assignment Zhang Rui
@ 2025-04-17  7:37 ` Giovanni Gherdovich
  2 siblings, 0 replies; 4+ messages in thread
From: Giovanni Gherdovich @ 2025-04-17  7:37 UTC (permalink / raw)
  To: Zhang Rui, rafael.j.wysocki; +Cc: linux-kernel, linux-pm, linux-acpi

On Wed Apr 9, 2025 02:50, Zhang Rui wrote:
> This patch series does further cleanups for
> acpi_processor_get_cstate_info() on top of
> https://lore.kernel.org/all/20250328143040.9348-2-ggherdovich@suse.cz/
> 
> thanks,
> rui
> 
> ----------------------------------------------------------------
> Zhang Rui (2):
>        ACPI: processor: idle: Set pr->flags.power unconditionally
>        ACPI: processor: idle: Remove redundant pr->power.count assignment
> 
>   drivers/acpi/processor_idle.c | 8 +-------
>   1 file changed, 1 insertion(+), 7 deletions(-)

Thanks a lot Rui for this cleanup.

To the series:

Acked-by: Giovanni Gherdovich <ggherdovich@suse.cz>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-04-17  7:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-09  0:50 [PATCH 0/2] ACPI: processor: idle: acpi_processor_get_cstate_info() cleanup Zhang Rui
2025-04-09  0:50 ` [PATCH 1/2] ACPI: processor: idle: Set pr->flags.power unconditionally Zhang Rui
2025-04-09  0:50 ` [PATCH 2/2] ACPI: processor: idle: Remove redundant pr->power.count assignment Zhang Rui
2025-04-17  7:37 ` [PATCH 0/2] ACPI: processor: idle: acpi_processor_get_cstate_info() cleanup Giovanni Gherdovich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®