linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sivaram Nair <sivaramn@nvidia.com>
To: rafael.j.wysocki@intel.com, daniel.lezcano@linaro.org,
	shuox.liu@intel.com, akpm@linux-foundation.org,
	yanmin_zhang@intel.com
Cc: linux-pm@vger.kernel.org, Sivaram Nair <sivaramn@nvidia.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] cpuidle: fix sysfs output for power_usage
Date: Fri, 14 Dec 2012 15:17:37 +0200	[thread overview]
Message-ID: <1355491060-970-2-git-send-email-sivaramn@nvidia.com> (raw)
In-Reply-To: <1355491060-970-1-git-send-email-sivaramn@nvidia.com>

cpuidle_state->power_usage is signed; so change the corresponding sysfs
ops to output signed value instead of unsigned.

Signed-off-by: Sivaram Nair <sivaramn@nvidia.com>
---
 drivers/cpuidle/sysfs.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
index 3409429..2fc79cd 100644
--- a/drivers/cpuidle/sysfs.c
+++ b/drivers/cpuidle/sysfs.c
@@ -232,6 +232,13 @@ static struct cpuidle_state_attr attr_##_name = __ATTR(_name, 0644, show, store)
 static ssize_t show_state_##_name(struct cpuidle_state *state, \
 			 struct cpuidle_state_usage *state_usage, char *buf) \
 { \
+	return sprintf(buf, "%d\n", state->_name);\
+}
+
+#define define_show_state_u_function(_name) \
+static ssize_t show_state_##_name(struct cpuidle_state *state, \
+			 struct cpuidle_state_usage *state_usage, char *buf) \
+{ \
 	return sprintf(buf, "%u\n", state->_name);\
 }
 
@@ -270,7 +277,7 @@ static ssize_t show_state_##_name(struct cpuidle_state *state, \
 	return sprintf(buf, "%s\n", state->_name);\
 }
 
-define_show_state_function(exit_latency)
+define_show_state_u_function(exit_latency)
 define_show_state_function(power_usage)
 define_show_state_ull_function(usage)
 define_show_state_ull_function(time)
-- 
1.7.9.5


  reply	other threads:[~2012-12-14 13:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-14 13:17 [PATCH 1/2] cpuidle: fix finding state with min power_usage Sivaram Nair
2012-12-14 13:17 ` Sivaram Nair [this message]
2012-12-15  0:03   ` [PATCH 2/2] cpuidle: fix sysfs output for power_usage 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1355491060-970-2-git-send-email-sivaramn@nvidia.com \
    --to=sivaramn@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=shuox.liu@intel.com \
    --cc=yanmin_zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).