[PATCH 1/2] [USB]/[misc]: Add waiting in transfer abortion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Kirill Kapranov <kirill.kirillovich.kapranov@xxxxxxxxx>

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@xxxxxxxxx>
---
 drivers/usb/misc/adutux.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c
index 4b87127..9669377 100644
--- a/drivers/usb/misc/adutux.c
+++ b/drivers/usb/misc/adutux.c
@@ -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);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux