diff options
author | Louis Yung-Chieh Lo <yjlou@chromium.org> | 2014-04-14 15:51:42 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-04-21 20:58:32 +0000 |
commit | 58878e79e07f33050d6ff8d280e5db63b5902e10 (patch) | |
tree | 05abf3306c786062bdf843c53c515f9cac0a2e2d /include/charge_state.h | |
parent | bd1a3ffeaf6d40d96b43c1169b150ae68a6d1291 (diff) | |
download | chrome-ec-58878e79e07f33050d6ff8d280e5db63b5902e10.tar.gz |
Fixed the stack overflow bug in 'battery' console command.stabilize-5784.0.B
On the Nyan EC, we almost run out of the stack of console task.
Instead of making that struct static or global, we print the cached data.
Read the issue tracker for more detailed discussion.
BUG=chrome-os-partner:28027
BRANCH=tot
TEST=verified on nyan with/without battery.
The "battery" console command doesn't crash the system.
Change-Id: Id5246724760aed4cf1df827baf115007b2ffb48e
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/194875
Reviewed-by: Dave Parker <dparker@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'include/charge_state.h')
-rw-r--r-- | include/charge_state.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/charge_state.h b/include/charge_state.h index 35c2041d45..0da544422f 100644 --- a/include/charge_state.h +++ b/include/charge_state.h @@ -103,6 +103,13 @@ int charge_want_shutdown(void); */ int charge_temp_sensor_get_val(int idx, int *temp_ptr); +/** + * Get the pointer to the battery parameters we saved in charge state. + * + * Use this carefully. Other threads can modify data while you are reading. + */ +const struct batt_params *charger_current_battery_params(void); + /* Pick the right implementation */ #ifdef CONFIG_CHARGER_V1 |