2019-04-15 10:38:57

by Lei YU

[permalink] [raw]
Subject: [PATCH] hwmon (occ): Fix extended status bits

The occ's extended status is checked and shown as sysfs attributes. But
the code was incorrectly checking the "status" bits.
Fix it by checking the "ext_status" bits.

Signed-off-by: Lei YU <[email protected]>
---
drivers/hwmon/occ/sysfs.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/hwmon/occ/sysfs.c b/drivers/hwmon/occ/sysfs.c
index fe3d15e..a71ca94 100644
--- a/drivers/hwmon/occ/sysfs.c
+++ b/drivers/hwmon/occ/sysfs.c
@@ -42,16 +42,16 @@ static ssize_t occ_sysfs_show(struct device *dev,
val = !!(header->status & OCC_STAT_ACTIVE);
break;
case 2:
- val = !!(header->status & OCC_EXT_STAT_DVFS_OT);
+ val = !!(header->ext_status & OCC_EXT_STAT_DVFS_OT);
break;
case 3:
- val = !!(header->status & OCC_EXT_STAT_DVFS_POWER);
+ val = !!(header->ext_status & OCC_EXT_STAT_DVFS_POWER);
break;
case 4:
- val = !!(header->status & OCC_EXT_STAT_MEM_THROTTLE);
+ val = !!(header->ext_status & OCC_EXT_STAT_MEM_THROTTLE);
break;
case 5:
- val = !!(header->status & OCC_EXT_STAT_QUICK_DROP);
+ val = !!(header->ext_status & OCC_EXT_STAT_QUICK_DROP);
break;
case 6:
val = header->occ_state;
--
2.7.4


2019-04-15 20:35:43

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH] hwmon (occ): Fix extended status bits

On Mon, Apr 15, 2019 at 06:37:20PM +0800, Lei YU wrote:
> The occ's extended status is checked and shown as sysfs attributes. But
> the code was incorrectly checking the "status" bits.
> Fix it by checking the "ext_status" bits.
>
> Signed-off-by: Lei YU <[email protected]>

Looks ok to me, but can I get a confirmation from someone at IBM ?

Thanks,
Guenter

> ---
> drivers/hwmon/occ/sysfs.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/hwmon/occ/sysfs.c b/drivers/hwmon/occ/sysfs.c
> index fe3d15e..a71ca94 100644
> --- a/drivers/hwmon/occ/sysfs.c
> +++ b/drivers/hwmon/occ/sysfs.c
> @@ -42,16 +42,16 @@ static ssize_t occ_sysfs_show(struct device *dev,
> val = !!(header->status & OCC_STAT_ACTIVE);
> break;
> case 2:
> - val = !!(header->status & OCC_EXT_STAT_DVFS_OT);
> + val = !!(header->ext_status & OCC_EXT_STAT_DVFS_OT);
> break;
> case 3:
> - val = !!(header->status & OCC_EXT_STAT_DVFS_POWER);
> + val = !!(header->ext_status & OCC_EXT_STAT_DVFS_POWER);
> break;
> case 4:
> - val = !!(header->status & OCC_EXT_STAT_MEM_THROTTLE);
> + val = !!(header->ext_status & OCC_EXT_STAT_MEM_THROTTLE);
> break;
> case 5:
> - val = !!(header->status & OCC_EXT_STAT_QUICK_DROP);
> + val = !!(header->ext_status & OCC_EXT_STAT_QUICK_DROP);
> break;
> case 6:
> val = header->occ_state;

2019-04-15 22:19:05

by Eddie James

[permalink] [raw]
Subject: Re: [PATCH] hwmon (occ): Fix extended status bits


On 4/15/19 3:28 PM, Guenter Roeck wrote:
> On Mon, Apr 15, 2019 at 06:37:20PM +0800, Lei YU wrote:
>> The occ's extended status is checked and shown as sysfs attributes. But
>> the code was incorrectly checking the "status" bits.
>> Fix it by checking the "ext_status" bits.
>>
>> Signed-off-by: Lei YU <[email protected]>
> Looks ok to me, but can I get a confirmation from someone at IBM ?


Yes. Thanks Lei.


Reviewed-by: Eddie James <[email protected]>


>
> Thanks,
> Guenter
>
>> ---
>> drivers/hwmon/occ/sysfs.c | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/hwmon/occ/sysfs.c b/drivers/hwmon/occ/sysfs.c
>> index fe3d15e..a71ca94 100644
>> --- a/drivers/hwmon/occ/sysfs.c
>> +++ b/drivers/hwmon/occ/sysfs.c
>> @@ -42,16 +42,16 @@ static ssize_t occ_sysfs_show(struct device *dev,
>> val = !!(header->status & OCC_STAT_ACTIVE);
>> break;
>> case 2:
>> - val = !!(header->status & OCC_EXT_STAT_DVFS_OT);
>> + val = !!(header->ext_status & OCC_EXT_STAT_DVFS_OT);
>> break;
>> case 3:
>> - val = !!(header->status & OCC_EXT_STAT_DVFS_POWER);
>> + val = !!(header->ext_status & OCC_EXT_STAT_DVFS_POWER);
>> break;
>> case 4:
>> - val = !!(header->status & OCC_EXT_STAT_MEM_THROTTLE);
>> + val = !!(header->ext_status & OCC_EXT_STAT_MEM_THROTTLE);
>> break;
>> case 5:
>> - val = !!(header->status & OCC_EXT_STAT_QUICK_DROP);
>> + val = !!(header->ext_status & OCC_EXT_STAT_QUICK_DROP);
>> break;
>> case 6:
>> val = header->occ_state;

2019-04-16 00:23:55

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH] hwmon (occ): Fix extended status bits

On Mon, Apr 15, 2019 at 06:37:20PM +0800, Lei YU wrote:
> The occ's extended status is checked and shown as sysfs attributes. But
> the code was incorrectly checking the "status" bits.
> Fix it by checking the "ext_status" bits.
>
> Signed-off-by: Lei YU <[email protected]>
> Reviewed-by: Eddie James <[email protected]>

Applied.

Thanks,
Guenter

> ---
> drivers/hwmon/occ/sysfs.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/hwmon/occ/sysfs.c b/drivers/hwmon/occ/sysfs.c
> index fe3d15e..a71ca94 100644
> --- a/drivers/hwmon/occ/sysfs.c
> +++ b/drivers/hwmon/occ/sysfs.c
> @@ -42,16 +42,16 @@ static ssize_t occ_sysfs_show(struct device *dev,
> val = !!(header->status & OCC_STAT_ACTIVE);
> break;
> case 2:
> - val = !!(header->status & OCC_EXT_STAT_DVFS_OT);
> + val = !!(header->ext_status & OCC_EXT_STAT_DVFS_OT);
> break;
> case 3:
> - val = !!(header->status & OCC_EXT_STAT_DVFS_POWER);
> + val = !!(header->ext_status & OCC_EXT_STAT_DVFS_POWER);
> break;
> case 4:
> - val = !!(header->status & OCC_EXT_STAT_MEM_THROTTLE);
> + val = !!(header->ext_status & OCC_EXT_STAT_MEM_THROTTLE);
> break;
> case 5:
> - val = !!(header->status & OCC_EXT_STAT_QUICK_DROP);
> + val = !!(header->ext_status & OCC_EXT_STAT_QUICK_DROP);
> break;
> case 6:
> val = header->occ_state;