Skip to content

Commit 0ea6273

Browse files
LiHuiSong1groeck
authored andcommitted
hwmon: (acpi_power_meter) Fix the fake power alarm reporting
We encountered a problem that a fake power alarm is reported to user on the platform unsupported notifications at the second step below: 1> Query 'power1_alarm' attribute when the power capping occurs. 2> Query 'power1_alarm' attribute when the power capping is over and the current average power is less then power cap value. The root cause is that the resource->power_alarm is set to true at the first step. And power meter use this old value to show the power alarm state instead of the current the comparison value. Signed-off-by: Huisong Li <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 9fee7d1 commit 0ea6273

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/hwmon/acpi_power_meter.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,13 @@ static ssize_t show_val(struct device *dev,
437437
ret = update_cap(resource);
438438
if (ret)
439439
return ret;
440+
resource->power_alarm = resource->power > resource->cap;
441+
val = resource->power_alarm;
442+
} else {
443+
val = resource->power_alarm ||
444+
resource->power > resource->cap;
445+
resource->power_alarm = resource->power > resource->cap;
440446
}
441-
val = resource->power_alarm || resource->power > resource->cap;
442-
resource->power_alarm = resource->power > resource->cap;
443447
break;
444448
case 7:
445449
case 8:

0 commit comments

Comments
 (0)