USB: gadget: f_mtp: Don't block in mtp_send_event
authorMike Lockwood <lockwood@android.com>
Thu, 10 Feb 2011 16:54:53 +0000 (11:54 -0500)
committerMike Lockwood <lockwood@android.com>
Thu, 10 Feb 2011 17:21:02 +0000 (12:21 -0500)
commitf35c505ce33f5cb97dca9532c510740a666161e4
tree624803ae38dbe8817da66d79ced18ab6e01c9b6c
parent99648ea95eaa167e3cb7bc37403fdc7d5da0e56c
USB: gadget: f_mtp: Don't block in mtp_send_event

We used to wait for the previous interrupt packet to complete before sending
the next packet.  But unfortunately the previous packet will not complete
until USB is disconnected if the host is not listening on the interrupt
endpoint (which is the case with libmtp on Linux and Mac).
To avoid hanging indefinitely in this case, we now simply return -EBUSY
if the previous interrupt packet has not completed yet.

Signed-off-by: Mike Lockwood <lockwood@android.com>
drivers/usb/gadget/f_mtp.c