power: common: uint64divmod() for host_command_hibernation_delay()

This change is implemented so we won't need the 64 bit division
for nds32 core(__udivdi3).

Please have a look at CL:314400.

Signed-off-by: Dino Li <dino.li@ite.com.tw>

BRANCH=none
BUG=none
TEST=Issue the host command by "ectool hibdelay xx" and check if
     hibernation delay was updated.

Change-Id: Ia2f08381e464563d954a6bf5998688cd9298fd38
Reviewed-on: https://chromium-review.googlesource.com/384436
Commit-Ready: Dino Li <Dino.Li@ite.com.tw>
Tested-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
Dino Li
2016-09-13 13:21:11 +08:00
committed by chrome-bot
parent d6b0a1cc88
commit 1cdd2d52fc

View File

@@ -652,8 +652,11 @@ static int host_command_hibernation_delay(struct host_cmd_handler_args *args)
const struct ec_params_hibernation_delay *p = args->params;
struct ec_response_hibernation_delay *r = args->response;
uint32_t time_g3 = (uint32_t)((get_time().val - last_shutdown_time)
/ SECOND);
uint32_t time_g3;
uint64_t t = get_time().val - last_shutdown_time;
uint64divmod(&t, SECOND);
time_g3 = (uint32_t)t;
/* Only change the hibernation delay if seconds is non-zero. */
if (p->seconds)