diff options
| author | Tim Douglas <me@timdoug.com> | 2026-10-12 22:21:53 -0400 |
|---|---|---|
| committer | Sebastian Reichel <sebastian.reichel@collabora.com> | 2026-10-17 23:39:00 +0200 |
| commit | 8ae5a3f40045ff486826ed6b6a83e39a0f380073 (patch) | |
| tree | 41878242c9c80aded4c0092272383119405d3581 /rust/kernel/alloc/allocator | |
| parent | a49f86cd1333c6e12fd37bc0b3234ace10072553 (diff) | |
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>
Diffstat (limited to 'rust/kernel/alloc/allocator')
0 files changed, 0 insertions, 0 deletions
