Skip to content

Commit de1675d

Browse files
committed
Revert "ACPI: battery: negate current when discharging"
Revert commit 234f715 ("ACPI: battery: negate current when discharging") breaks not one but several userspace implementations of battery monitoring: Steam and MangoHud. Perhaps it breaks more, but those are the two that have been tested. Reported-by: Matthew Schwartz <[email protected]> Closes: https://lore.kernel.org/linux-acpi/[email protected]/ Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 234f715 commit de1675d

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

drivers/acpi/battery.c

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -243,23 +243,10 @@ static int acpi_battery_get_property(struct power_supply *psy,
243243
break;
244244
case POWER_SUPPLY_PROP_CURRENT_NOW:
245245
case POWER_SUPPLY_PROP_POWER_NOW:
246-
if (battery->rate_now == ACPI_BATTERY_VALUE_UNKNOWN) {
246+
if (battery->rate_now == ACPI_BATTERY_VALUE_UNKNOWN)
247247
ret = -ENODEV;
248-
break;
249-
}
250-
251-
val->intval = battery->rate_now * 1000;
252-
/*
253-
* When discharging, the current should be reported as a
254-
* negative number as per the power supply class interface
255-
* definition.
256-
*/
257-
if (psp == POWER_SUPPLY_PROP_CURRENT_NOW &&
258-
(battery->state & ACPI_BATTERY_STATE_DISCHARGING) &&
259-
acpi_battery_handle_discharging(battery)
260-
== POWER_SUPPLY_STATUS_DISCHARGING)
261-
val->intval = -val->intval;
262-
248+
else
249+
val->intval = battery->rate_now * 1000;
263250
break;
264251
case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
265252
case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN:

0 commit comments

Comments
 (0)