usb-ehci: Fix races with controller on updates to QH.
authorKevin O'Connor <kevin@koconnor.net>
Sat, 19 Nov 2011 19:21:51 +0000 (14:21 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Sat, 19 Nov 2011 19:21:51 +0000 (14:21 -0500)
commit49ecf6933af0b803defcfe10f5786e5f1eee7f46
tree205939acac563c3b811305a64702b89ebc210e37
parent08589ac092e7db9fed1e533f7d5f713af5e9efda
usb-ehci: Fix races with controller on updates to QH.

The EHCI controller writes to the TD after writing to the QH, so the
driver must wait for all the TDs to be complete before considering the
transfer completed.  (The previous implementation was particularly bad
as it only checked that the last TD was in progress before considering
the transfer complete.)

Also, avoid writing to the qh.token field when starting a transfer to
eliminate a potential race.  Place the qh.token in an available state
by default - that way only the qtd_next field needs to be updated to
start the transfer.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
src/usb-ehci.c