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)
committerColin Cross <ccross@android.com>
Tue, 14 Jun 2011 16:09:53 +0000 (09:09 -0700)
commit292b96396c25c465f7f17d5c0d0e182a6b7a4e26
treeac74aebc2e9e3987bf79f5cb1efce9db81658f64
parentaecca43f09d029eb98bec88b6da3b3c6897e42f5
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