linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] cpuidle: fix finding state with min power_usage
@ 2012-12-14 13:17 Sivaram Nair
  2012-12-14 13:17 ` [PATCH 2/2] cpuidle: fix sysfs output for power_usage Sivaram Nair
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Sivaram Nair @ 2012-12-14 13:17 UTC (permalink / raw)
  To: rafael.j.wysocki, len.brown, daniel.lezcano, khilman, ccross,
	riel, youquan.song, akpm, shuox.liu
  Cc: linux-pm, Sivaram Nair, linux-kernel

Since cpuidle_state.power_usage is a signed value, use INT_MAX (instead
of -1) to init the local copies so that functions that tries to find
cpuidle states with minimum power usage works correctly even if they use
non-negative values.

Signed-off-by: Sivaram Nair <sivaramn@nvidia.com>
---
 drivers/cpuidle/cpuidle.c        |    2 +-
 drivers/cpuidle/governors/menu.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 8df53dd..fb4a7dd 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -70,7 +70,7 @@ int cpuidle_play_dead(void)
 	struct cpuidle_device *dev = __this_cpu_read(cpuidle_devices);
 	struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
 	int i, dead_state = -1;
-	int power_usage = -1;
+	int power_usage = INT_MAX;
 
 	if (!drv)
 		return -ENODEV;
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index bd40b94..20ea33a 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -312,7 +312,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
 {
 	struct menu_device *data = &__get_cpu_var(menu_devices);
 	int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY);
-	int power_usage = -1;
+	int power_usage = INT_MAX;
 	int i;
 	int multiplier;
 	struct timespec t;
-- 
1.7.9.5


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

end of thread, other threads:[~2012-12-17 12:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-14 13:17 [PATCH 1/2] cpuidle: fix finding state with min power_usage Sivaram Nair
2012-12-14 13:17 ` [PATCH 2/2] cpuidle: fix sysfs output for power_usage Sivaram Nair
2012-12-15  0:03   ` Rafael J. Wysocki
2012-12-17  7:38     ` Sivaram Nair
2012-12-17  7:56       ` Rafael J. Wysocki
2012-12-17  8:46         ` Sivaram Nair
2012-12-17 12:09           ` Rafael J. Wysocki
2012-12-14 17:43 ` [PATCH 1/2] cpuidle: fix finding state with min power_usage Rik van Riel
2012-12-15  0:02 ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).