diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2021-05-28 11:35:56 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-07-15 16:18:30 +0000 |
commit | 5250d3b79f86709d1029f020965456f457455f01 (patch) | |
tree | 4564bea23178a792a7cc3e616635b0ecc532c649 /common/charge_state_v2.c | |
parent | 8b3035567f4ad4cc4cf8092d69b9dceabd801f7f (diff) | |
download | chrome-ec-5250d3b79f86709d1029f020965456f457455f01.tar.gz |
chgstv2: Join two battery revival code blocks
The 'else' at line 2085 can accommodate only one statement since it
doesn't have a curly brace. So, it's (unintentionally) closed by
'battery_seems_to_be_disconnected = ...', which was inserted by
crrev.com/c/210343. It should be closed by the subsequent code (
the code wrapped by CONFIG_BATTERY_REVIVE_DISCONNECT).
There are two code blocks which fix unresponsive batteries (i.e.
CONFIG_BATTERY_REQUESTS_NIL_WHEN_DEAD &
CONFIG_BATTERY_REVIVE_DISCONNECT). chgstv2 needs to run one of these
at a time not both. That is, if CONFIG_BATTERY_REQUESTS_NIL_WHEN_DEAD
is applied, CONFIG_BATTERY_REVIVE_DISCONNECT should be skipped.
BUG=None
BRANCH=None
TEST=buildall
Change-Id: Iae13cf6c33d02fe62e89b6c1bb2b5b3dc49ff8fd
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2929342
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common/charge_state_v2.c')
-rw-r--r-- | common/charge_state_v2.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c index 948789fba6..6f1cc833c5 100644 --- a/common/charge_state_v2.c +++ b/common/charge_state_v2.c @@ -2069,6 +2069,15 @@ void charger_task(void *u) } /* The battery is responding. Yay. Try to use it. */ + + /* + * Always check the disconnect state. This is because + * the battery disconnect state is one of the items used + * to decide whether or not to leave safe mode. + */ + battery_seems_disconnected = + battery_get_disconnect_state() == BATTERY_DISCONNECTED; + #ifdef CONFIG_BATTERY_REQUESTS_NIL_WHEN_DEAD /* * TODO (crosbug.com/p/29467): remove this workaround @@ -2085,15 +2094,6 @@ void charger_task(void *u) } else #endif #ifdef CONFIG_BATTERY_REVIVE_DISCONNECT - /* - * Always check the disconnect state. This is because - * the battery disconnect state is one of the items used - * to decide whether or not to leave safe mode. - */ - battery_seems_to_be_disconnected = - battery_get_disconnect_state() == - BATTERY_DISCONNECTED; - if (curr.requested_voltage == 0 && curr.requested_current == 0 && battery_seems_disconnected) { |