Commit 49dcc4f6 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull ACPI fix from Rafael Wysocki:
 "Revert a problematic ACPI battery driver change merged recently"

* tag 'acpi-6.16-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  Revert "ACPI: battery: negate current when discharging"
parents b1bf2ef6 de1675de
Loading
Loading
Loading
Loading
+3 −16
Original line number Diff line number Diff line
@@ -243,23 +243,10 @@ static int acpi_battery_get_property(struct power_supply *psy,
		break;
	case POWER_SUPPLY_PROP_CURRENT_NOW:
	case POWER_SUPPLY_PROP_POWER_NOW:
		if (battery->rate_now == ACPI_BATTERY_VALUE_UNKNOWN) {
		if (battery->rate_now == ACPI_BATTERY_VALUE_UNKNOWN)
			ret = -ENODEV;
			break;
		}

		else
			val->intval = battery->rate_now * 1000;
		/*
		 * When discharging, the current should be reported as a
		 * negative number as per the power supply class interface
		 * definition.
		 */
		if (psp == POWER_SUPPLY_PROP_CURRENT_NOW &&
		    (battery->state & ACPI_BATTERY_STATE_DISCHARGING) &&
		    acpi_battery_handle_discharging(battery)
				== POWER_SUPPLY_STATUS_DISCHARGING)
			val->intval = -val->intval;

		break;
	case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
	case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN: