Linux kernel -stable discussions
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] power: supply: generic-adc-battery: fix status with no supplier" failed to apply to 5.15-stable tree
@ 2026-11-07 11:08 Sasha Levin
  2026-11-10 23:10 ` [PATCH 5.15.y 1/7] power: supply: generic-adc-battery: convert to managed resources Sasha Levin
  0 siblings, 1 reply; 8+ messages in thread
From: Sasha Levin @ 2026-11-07 11:08 UTC (permalink / raw)
  To: me, sebastian.reichel; +Cc: stable

The patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x 8ae5a3f40045ff486826ed6b6a83e39a0f380073
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '20261107060802-failed-5.15-8ae5a3f40045@kernel.org' --subject-prefix 'PATCH 5.15.y' 'HEAD^..'

Thanks,
Sasha

------------------ original commit in Linus's tree ------------------

From 8ae5a3f40045ff486826ed6b6a83e39a0f380073 Mon Sep 17 00:00:00 2001
From: Tim Douglas <me@timdoug.com>
Date: Mon, 12 Oct 2026 22:21:53 -0400
Subject: [PATCH] power: supply: generic-adc-battery: fix status with no
 supplier

power_supply_am_i_supplied() returns -ENODEV when no registered power
supply supplies the battery. generic-adc-battery's gab_work() tests this
return value as a boolean, so -ENODEV takes the supplied branch and
reports CHARGING, or NOT_CHARGING if the charge-finished GPIO is asserted,
instead of DISCHARGING.

This was noticed while bringing up an out-of-tree Linux port to the
WikiReader: the driver reported CHARGING on a device powered by two AAA
batteries with no charging hardware.

Only a positive return value indicates an online supplier, so treat zero
and negative returns as discharging.

Fixes: 46cecd130d55 ("power: supply: Fix power_supply_am_i_supplied to return -ENODEV when apropriate")
Cc: stable@vger.kernel.org
Signed-off-by: Tim Douglas <me@timdoug.com>
Link: https://patch.msgid.link/20261013022153.6707-1-me@timdoug.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
 drivers/power/supply/generic-adc-battery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/supply/generic-adc-battery.c b/drivers/power/supply/generic-adc-battery.c
index f3ca3ebb25333..c8ad3f11e8081 100644
--- a/drivers/power/supply/generic-adc-battery.c
+++ b/drivers/power/supply/generic-adc-battery.c
@@ -130,7 +130,7 @@ static void gab_work(struct work_struct *work)
 	adc_bat = container_of(delayed_work, struct gab, bat_work);
 	status = adc_bat->status;
 
-	if (!power_supply_am_i_supplied(adc_bat->psy))
+	if (power_supply_am_i_supplied(adc_bat->psy) <= 0)
 		adc_bat->status =  POWER_SUPPLY_STATUS_DISCHARGING;
 	else if (gab_charge_finished(adc_bat))
 		adc_bat->status = POWER_SUPPLY_STATUS_NOT_CHARGING;
-- 
2.53.0





^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-11-10 23:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-07 11:08 FAILED: patch "[PATCH] power: supply: generic-adc-battery: fix status with no supplier" failed to apply to 5.15-stable tree Sasha Levin
2026-11-10 23:10 ` [PATCH 5.15.y 1/7] power: supply: generic-adc-battery: convert to managed resources Sasha Levin
2026-11-10 23:10   ` [PATCH 5.15.y 2/7] power: supply: generic-adc-battery: drop jitter delay support Sasha Levin
2026-11-10 23:10   ` [PATCH 5.15.y 3/7] power: supply: generic-adc-battery: drop charge now support Sasha Levin
2026-11-10 23:10   ` [PATCH 5.15.y 4/7] power: supply: generic-adc-battery: use simple-battery API Sasha Levin
2026-11-10 23:10   ` [PATCH 5.15.y 5/7] power: supply: generic-adc-battery: simplify read_channel logic Sasha Levin
2026-11-10 23:10   ` [PATCH 5.15.y 6/7] power: supply: generic-adc-battery: style fixes Sasha Levin
2026-11-10 23:10   ` [PATCH 5.15.y 7/7] power: supply: generic-adc-battery: fix status with no supplier Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox