diff mbox series

[2/3] hwmon: (ibmpowernv): Add support to read 64 bit sensors

Message ID 1525688738-9185-3-git-send-email-shilpa.bhat@linux.vnet.ibm.com (mailing list archive)
State Accepted
Commit 3c8c049aa7bdffaab2e53401fd5270a3acc32631
Headers show
Series Add support for energy sensors | expand

Commit Message

Shilpasri G Bhat May 7, 2018, 10:25 a.m. UTC
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(-)

Comments

Guenter Roeck May 9, 2018, 5:29 p.m. UTC | #1
On Mon, May 07, 2018 at 03:55:37PM +0530, Shilpasri G Bhat wrote:
> 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>

Acked-by: Guenter Roeck <linux@roeck-us.net>

I won't apply for the time being since it depends on patch 1/3 which is
outside hwmon.

> ---
>  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
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michael Ellerman May 14, 2018, 7:11 a.m. UTC | #2
Guenter Roeck <linux@roeck-us.net> writes:

> On Mon, May 07, 2018 at 03:55:37PM +0530, Shilpasri G Bhat wrote:
>> 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>
>
> Acked-by: Guenter Roeck <linux@roeck-us.net>
>
> I won't apply for the time being since it depends on patch 1/3 which is
> outside hwmon.

Do you mind if I take the series via the powerpc tree?

cheers
Guenter Roeck May 14, 2018, 10:35 a.m. UTC | #3
On 05/14/2018 12:11 AM, Michael Ellerman wrote:
> Guenter Roeck <linux@roeck-us.net> writes:
> 
>> On Mon, May 07, 2018 at 03:55:37PM +0530, Shilpasri G Bhat wrote:
>>> 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>
>>
>> Acked-by: Guenter Roeck <linux@roeck-us.net>
>>
>> I won't apply for the time being since it depends on patch 1/3 which is
>> outside hwmon.
> 
> Do you mind if I take the series via the powerpc tree?
> 

Fine with me.

Guenter
Michael Ellerman May 25, 2018, 11:41 a.m. UTC | #4
On Mon, 2018-05-07 at 10:25:37 UTC, Shilpasri G Bhat wrote:
> 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>
> Acked-by: Guenter Roeck <linux@roeck-us.net>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/3c8c049aa7bdffaab2e53401fd5270

cheers
diff mbox series

Patch

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,