summaryrefslogtreecommitdiff
path: root/common/host_command.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-10-25 10:26:16 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-10-31 18:43:39 +0000
commit2dc1418ccdad1b06f686cddc717e02bcb80ff648 (patch)
tree3feb80ddd776a1c641fbc37b111cf3a06edceb3d /common/host_command.c
parentd16a246ea9c7d5982d4eb932c09310146ab3463e (diff)
downloadchrome-ec-2dc1418ccdad1b06f686cddc717e02bcb80ff648.tar.gz
cleanup: Assorted TODO comments
Remove comments if no longer applicable, or assign bug numbers if they still are. Tidy some debug output. No code changes other than the debug output. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms, pass unit tests Change-Id: I2277e73fbf8cc93f3b1b35ee115e0f2f52eb8cf9 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/175215 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'common/host_command.c')
-rw-r--r--common/host_command.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/common/host_command.c b/common/host_command.c
index 55f27d9199..34c274001a 100644
--- a/common/host_command.c
+++ b/common/host_command.c
@@ -72,44 +72,46 @@ test_mockable void host_send_response(struct host_cmd_handler_args *args)
{
#ifdef CONFIG_HOST_COMMAND_STATUS
/*
- * TODO(sjg@chromium.org):
- * If we got an 'in progress' previously, then this
- * must be the completion of that command, so stash the result
- * code. We can't send it back to the host now since we already sent
- * the in-progress response and the host is on to other things now.
*
- * If we are in interrupt context, then we are handling a
- * get_status response or an immediate error which prevented us
- * from processing the command. Note we can't check for the
- * GET_COMMS_STATUS command in args->command because the original
- * command value has now been overwritten.
+ * If we are in interrupt context, then we are handling a get_status
+ * response or an immediate error which prevented us from processing
+ * the command. Note we can't check for the GET_COMMS_STATUS command in
+ * args->command because the original command value has now been
+ * overwritten.
*
* When a EC_CMD_RESEND_RESPONSE arrives we will supply this response
* to that command.
- *
- * We don't support stashing response data, so mark the response as
- * unavailable in that case.
- *
- * TODO(sjg@chromium.org): If we stashed the command in host_command
- * before processing it, then it would not get overwritten by a
- * subsequent command and we could simplify the logic here by adding
- * a flag to host_cmd_handler_args to indicate that the command had
- * an interim response. We would have to make this stashing dependent
- * on CONFIG_HOST_COMMAND_STATUS also.
*/
if (!in_interrupt_context()) {
if (command_pending) {
- CPRINTF("pending complete, size=%d, result=%d\n",
+ /*
+ * We previously got EC_RES_IN_PROGRESS. This must be
+ * the completion of that command, so stash the result
+ * code.
+ */
+ CPRINTF("[%T HC pending done, size=%d, result=%d]\n",
args->response_size, args->result);
+
+ /*
+ * We don't support stashing response data, so mark the
+ * response as unavailable in that case.
+ */
if (args->response_size != 0)
saved_result = EC_RES_UNAVAILABLE;
else
saved_result = args->result;
+
+ /*
+ * We can't send the response back to the host now
+ * since we already sent the in-progress response and
+ * the host is on to other things now.
+ */
command_pending = 0;
return;
+
} else if (args->result == EC_RES_IN_PROGRESS) {
command_pending = 1;
- CPRINTF("Command pending\n");
+ CPRINTF("[HC pending]\n");
}
}
#endif