diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2018-10-26 12:46:35 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-10-30 01:04:53 -0700 |
commit | cc80d2bed27d5fee1cf046641c64b7dd2a12e00c (patch) | |
tree | be07a2cf3b60d2f93f9670464d05fcb027c000df /common/battery.c | |
parent | b47ed2a108c679de26be89fa258931ddf040e446 (diff) | |
download | chrome-ec-cc80d2bed27d5fee1cf046641c64b7dd2a12e00c.tar.gz |
Battery: Force data update for EC_CMD_BATTERY_GET_STATIC
Currently, EC_CMD_BATTERY_GET_STATIC reads static data which was
updated previously. Since static data is updated only on special
conditions, it causes the command to return stale data.
This change makes the command force data update.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
BUG=b:117938291
BRANCH=none
TEST=buildall
Change-Id: I7acdfe5bac5ab87001ee57bd053c7cef411dfdd1
Reviewed-on: https://chromium-review.googlesource.com/1302834
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common/battery.c')
-rw-r--r-- | common/battery.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/common/battery.c b/common/battery.c index 9252fb9a94..21e6563b2b 100644 --- a/common/battery.c +++ b/common/battery.c @@ -445,6 +445,7 @@ DECLARE_HOST_COMMAND(EC_CMD_BATTERY_VENDOR_PARAM, #ifdef CONFIG_BATTERY_V2 #ifdef CONFIG_HOSTCMD_BATTERY_V2 +static void battery_update(enum battery_index i); static int host_command_battery_get_static(struct host_cmd_handler_args *args) { const struct ec_params_battery_static_info *p = args->params; @@ -452,7 +453,7 @@ static int host_command_battery_get_static(struct host_cmd_handler_args *args) if (p->index < 0 || p->index >= CONFIG_BATTERY_COUNT) return EC_RES_INVALID_PARAM; - + battery_update(p->index); args->response_size = sizeof(*r); memcpy(r, &battery_static[p->index], sizeof(*r)); |