diff options
Diffstat (limited to 'common/host_command.c')
-rw-r--r-- | common/host_command.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/common/host_command.c b/common/host_command.c index 1420e79434..1a1c21fd40 100644 --- a/common/host_command.c +++ b/common/host_command.c @@ -49,15 +49,19 @@ void host_command_received(struct host_cmd_handler_args *args) if (args->command == EC_CMD_REBOOT) { system_reset(SYSTEM_RESET_HARD); /* Reset should never return; if it does, post an error */ - host_send_response(EC_RES_ERROR); - return; + args->result = EC_RES_ERROR; } - /* Save the command */ - pending_args = args; + /* If the driver has signalled an error, send the response now */ + if (args->result) { + args->send_response(args); + } else { + /* Save the command */ + pending_args = args; - /* Wake up the task to handle the command */ - task_set_event(TASK_ID_HOSTCMD, TASK_EVENT_CMD_PENDING, 0); + /* Wake up the task to handle the command */ + task_set_event(TASK_ID_HOSTCMD, TASK_EVENT_CMD_PENDING, 0); + } } /* @@ -224,8 +228,9 @@ void host_command_task(void) int evt = task_wait_event(-1); /* process it */ if ((evt & TASK_EVENT_CMD_PENDING) && pending_args) { - enum ec_status res = host_command_process(pending_args); - host_send_response(res); + pending_args->result = + host_command_process(pending_args); + pending_args->send_response(pending_args); } } } |