summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Staaf <robotboy@chromium.org>2014-10-22 13:10:25 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-11-11 23:01:15 +0000
commit1ee2da7315a521b62f3ff7631857fdc0bb79eb23 (patch)
tree854a215f65f659704a3ae0eeed78f2b2332b1148
parent3df9de1e945b2ce6f6539fbd945c2e99a49e1bd8 (diff)
downloadchrome-ec-1ee2da7315a521b62f3ff7631857fdc0bb79eb23.tar.gz
CHERRY-PICK: USB-console: Don't wait in interrupt contexts
Previously the USB console code would wait for up to 30 ms for the USB packet buffer to become available for transmission, even if it was called from an interrupt context. This doesn't work because, even if we were OK with waiting this long in interrupt contexts, which we are not, we rightly assert that we are not in an interrupt context in task_wait_event, which usleep calls. This solution is a quick fix to only wait when not called from within an interrupt context. The correct solution is likely to decouple the printf code from directly calling the console driver code, instead we should place a queue between the driver and printf logic. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Enable USB console on discovery board and manually test. Change-Id: I8f6f820fefc970d84db2b637a1504193be4fd9ce Original-Change-Id: I5b6f7bbb77f75132c75935f8fda01e652a236ae0 Reviewed-on: https://chromium-review.googlesource.com/225867 Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/229155 Reviewed-by: Mohammed Habibulla <moch@chromium.org> Commit-Queue: Mohammed Habibulla <moch@chromium.org> Tested-by: Mohammed Habibulla <moch@chromium.org>
-rw-r--r--chip/stm32/usb_console.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/chip/stm32/usb_console.c b/chip/stm32/usb_console.c
index a8b219bb87..47e31711e0 100644
--- a/chip/stm32/usb_console.c
+++ b/chip/stm32/usb_console.c
@@ -146,7 +146,8 @@ static int usb_wait_console(void)
*/
if (last_tx_ok) {
while (usb_console_tx_valid() || !is_reset) {
- if (timestamp_expired(deadline, NULL)) {
+ if (timestamp_expired(deadline, NULL) ||
+ in_interrupt_context()) {
last_tx_ok = 0;
return EC_ERROR_TIMEOUT;
}