From 4aee90d5594863fc390e73dc880fb328cf4bfbd3 Mon Sep 17 00:00:00 2001 From: Alec Berg Date: Thu, 4 Jun 2015 11:47:32 -0700 Subject: pd: change pd_transmit() to only wait for TX complete event Change pd_transmit() to wait specifically for the TX complete event using task_wait_event_mask(). This fixes a bug that if another event, it will now restore that event instead of consuming it. BUG=chrome-os-partner:40920, chrome-os-partner:41290 BRANCH=smaug TEST=load onto glados and zinger and attach them a bunch of times and get stable contract with no hard resets. Change-Id: I36514ea45b5e2b5fd42acdad94e5786da5bd90b6 Signed-off-by: Alec Berg Reviewed-on: https://chromium-review.googlesource.com/276745 Reviewed-by: Vincent Palatin --- common/usb_pd_protocol.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'common/usb_pd_protocol.c') diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index a9f3eaa62a..7b72a44229 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -297,9 +297,7 @@ static int pd_transmit(int port, enum tcpm_transmit_type type, tcpm_transmit(port, type, header, data); /* Wait until TX is complete */ - do { - evt = task_wait_event(PD_T_TCPC_TX_TIMEOUT); - } while (!(evt & (TASK_EVENT_TIMER | PD_EVENT_TX))); + evt = task_wait_event_mask(PD_EVENT_TX, PD_T_TCPC_TX_TIMEOUT); if (evt & TASK_EVENT_TIMER) return -1; -- cgit v1.2.1