FAILED: patch "[PATCH] power: supply: generic-adc-battery: fix status with no supplier" failed to apply to 5.10-stable tree
Subsystems (2)
Sasha Levin
maintainerThe patch below does not apply to the 5.10-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 <[email protected]>.
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.10.y
git checkout FETCH_HEAD
git cherry-pick -x 8ae5a3f40045ff486826ed6b6a83e39a0f380073
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 8ae5a3f40045ff486826ed6b6a83e39a0f380073 Mon Sep 17 00:00:00 2001
From: Tim Douglas <[email protected]>
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.
--- drivers/power/supply/generic-adc-battery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/generic-adc-battery.c +1 -1
@@ -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 ;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 power: supply: generic-adc-battery: fix status with no supplier
From: Tim Douglas <[email protected]>
[ Upstream commit 8ae5a3f40045ff486826ed6b6a83e39a0f380073 ]
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.
--- drivers/power/supply/generic-adc-battery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/generic-adc-battery.c +1 -1
@@ -212,7 +212,7 @@ static void gab_work(struct work_struct *work) adc_bat = container_of(delayed_work, struct gab, bat_work); status = adc_bat->status; - is_plugged =power_supply_am_i_supplied (adc_bat->psy); + is_plugged =power_supply_am_i_supplied (adc_bat->psy) >0 ; adc_bat->cable_plugged = is_plugged;if (!is_plugged)
Signature · 1 line
2.53.0