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 <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/276745
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
Alec Berg
2015-06-04 11:47:32 -07:00
committed by ChromeOS Commit Bot
parent 0a7f37d720
commit 4aee90d559

View File

@@ -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;