LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
To: linux@roeck-us.net, mpe@ellerman.id.au
Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-hwmon@vger.kernel.org, benh@kernel.crashing.org,
	paulus@samba.org, jdelvare@suse.com, stewart@linux.vnet.ibm.com,
	Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
Subject: [PATCH 2/3] hwmon: (ibmpowernv): Add support to read 64 bit sensors
Date: Mon,  7 May 2018 15:55:37 +0530	[thread overview]
Message-ID: <1525688738-9185-3-git-send-email-shilpa.bhat@linux.vnet.ibm.com> (raw)
In-Reply-To: <1525688738-9185-1-git-send-email-shilpa.bhat@linux.vnet.ibm.com>

The firmware has supported for reading sensor values of size u32.
This patch adds support to use newer firmware functions which allows
to read the sensors of size u64.

Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
---
 drivers/hwmon/ibmpowernv.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/hwmon/ibmpowernv.c b/drivers/hwmon/ibmpowernv.c
index 5ccdd0b..74d9b5a 100644
--- a/drivers/hwmon/ibmpowernv.c
+++ b/drivers/hwmon/ibmpowernv.c
@@ -101,9 +101,10 @@ static ssize_t show_sensor(struct device *dev, struct device_attribute *devattr,
 	struct sensor_data *sdata = container_of(devattr, struct sensor_data,
 						 dev_attr);
 	ssize_t ret;
-	u32 x;
+	u64 x;
+
+	ret =  opal_get_sensor_data_u64(sdata->id, &x);
 
-	ret = opal_get_sensor_data(sdata->id, &x);
 	if (ret)
 		return ret;
 
@@ -114,7 +115,7 @@ static ssize_t show_sensor(struct device *dev, struct device_attribute *devattr,
 	else if (sdata->type == POWER_INPUT)
 		x *= 1000000;
 
-	return sprintf(buf, "%u\n", x);
+	return sprintf(buf, "%llu\n", x);
 }
 
 static ssize_t show_label(struct device *dev, struct device_attribute *devattr,
-- 
1.8.3.1

  parent reply	other threads:[~2018-05-07 10:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-07 10:25 [PATCH 0/3] Add support for energy sensors Shilpasri G Bhat
2018-05-07 10:25 ` [PATCH 1/3] powernv: opal-sensor: Add support to read 64bit sensor values Shilpasri G Bhat
2018-05-25 11:41   ` [1/3] " Michael Ellerman
2018-05-07 10:25 ` Shilpasri G Bhat [this message]
2018-05-09 17:29   ` [PATCH 2/3] hwmon: (ibmpowernv): Add support to read 64 bit sensors Guenter Roeck
2018-05-14  7:11     ` Michael Ellerman
2018-05-14 10:35       ` Guenter Roeck
2018-05-25 11:41   ` [2/3] " Michael Ellerman
2018-05-07 10:25 ` [PATCH 3/3] hwmon: (ibmpowernv) Add energy sensors Shilpasri G Bhat
2018-05-09 17:29   ` Guenter Roeck
2018-05-25 11:41   ` [3/3] " Michael Ellerman

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=1525688738-9185-3-git-send-email-shilpa.bhat@linux.vnet.ibm.com \
    --to=shilpa.bhat@linux.vnet.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    --cc=stewart@linux.vnet.ibm.com \
    --subject='Re: [PATCH 2/3] hwmon: (ibmpowernv): Add support to read 64 bit sensors' \
    /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

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).