From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7DE671A23AF; Tue, 15 Jul 2025 13:19:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752585575; cv=none; b=DF9e8OGh71vtas/5T6e76yOk/VFxrHxTRl6QR324VJyivD4G4az26+yBU3V+E93tLztpy/RoJlyNUKKoqMqSN1kvUI2r0f9Y0QRcLdIwmP8mqVlei6Ub7ZOWa2r3DLPmvsi2vlpRb+r2wZAZHHElI8Nxv6NBAZb/p7AprJC3T00= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752585575; c=relaxed/simple; bh=A4X9PBZM2V+5W1N/Js8uXsGgt8xYdWd5K084bOM64Kw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HrS+wHY8z3g+oSTzC0SMYk7KkDu8N8nFKnxRkOQyiKY8ORpX0VK8tmZAUdj7tZRjPEp4ktRLsPK6xU8G2GJ0rEAisjUotT4cKxmit62u9qTIlAw+yytAPZkCnfgZQAY5a8M2EN9TzA0ib/moJbFYz1ZNV+tM2Bm5nk/4zXFc07c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=MQRZHLxh; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="MQRZHLxh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6331C4CEE3; Tue, 15 Jul 2025 13:19:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1752585575; bh=A4X9PBZM2V+5W1N/Js8uXsGgt8xYdWd5K084bOM64Kw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MQRZHLxhXzwWIq9sfqZd1hbFxfBrCVHzomjjij5ByfNCygEiEPIHtXRPr0rgBMynU P5aQupGH9DTf7aDzRKSvfSZOnOFpMYTZYOo3rfmWGK5VdeblJyV851WOYIli4H3NKG wg6bEgnWnweGxkbIOWcbA5bqPUy0E0N0ior9rCSU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Matthew Schwartz , "Rafael J. Wysocki" Subject: [PATCH 6.12 084/163] Revert "ACPI: battery: negate current when discharging" Date: Tue, 15 Jul 2025 15:12:32 +0200 Message-ID: <20250715130812.097920304@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250715130808.777350091@linuxfoundation.org> References: <20250715130808.777350091@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Rafael J. Wysocki commit de1675de39aa945bad5937d1fde4df3682670639 upstream. Revert commit 234f71555019 ("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 Closes: https://lore.kernel.org/linux-acpi/87C1B2AF-D430-4568-B620-14B941A8ABA4@linux.dev/ Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/battery.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -243,23 +243,10 @@ static int acpi_battery_get_property(str 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; - } - - 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; - + else + val->intval = battery->rate_now * 1000; break; case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN: