Skip to content

Commit

Permalink
USB: adutux: Add waiting in transfer abortion
Browse files Browse the repository at this point in the history
Add waiting for an URB transmit finish that let the last URB to be sent
(to be not discarded) during 'release' procedure. W/o this waiting,the
last frame will be nearly always lost.

A test case: an attempt of sending a single frame:
echo -en "\001mk255" >/dev/adutux0

Signed-off-by: Kirill Kapranov <kirill.kirillovich.kapranov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Kirill Kapranov authored and Greg Kroah-Hartman committed Mar 9, 2018
1 parent 092bd5c commit 687ca63
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/usb/misc/adutux.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ static void adu_abort_transfers(struct adu_device *dev)
spin_lock_irqsave(&dev->buflock, flags);
if (!dev->out_urb_finished) {
spin_unlock_irqrestore(&dev->buflock, flags);
wait_event_timeout(dev->write_wait, dev->out_urb_finished,
COMMAND_TIMEOUT);
usb_kill_urb(dev->interrupt_out_urb);
} else
spin_unlock_irqrestore(&dev->buflock, flags);
Expand Down

0 comments on commit 687ca63

Please sign in to comment.