From c2505152f83ae17bba77909462362e678a62c66b Mon Sep 17 00:00:00 2001 From: Bryan Wu Date: Sat, 17 May 2008 19:01:20 +0800 Subject: [PATCH] MUSB: fix bug - since 2.6.24 urb API changed, giveback function return wrong status When MUSB got STALL, but reported "short read trasfer" usb-storage: Command MODE_SENSE (6 bytes) usb-storage: 1a 00 3f 00 c0 00 usb-storage: Bulk Command S 0x43425355 T 0x18 L 192 F 128 Trg 0 LUN 0 CL 6 usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes usb-storage: Status code 0; transferred 31/31 usb-storage: -- transfer complete usb-storage: Bulk command transfer result=0 usb-storage: usb_stor_bulk_transfer_sglist: xfer 192 bytes, 1 entries usb-storage: Status code -121; transferred 0/192 usb-storage: -- short read transfer usb-storage: Bulk data transfer result 0x1 usb-storage: Attempting to get CSW... usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes usb-storage: Status code 0; transferred 0/13 usb-storage: -- short transfer usb-storage: Received 0-length CSW; retrying... usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes usb-storage: Status code 0; transferred 0/13 usb-storage: -- short transfer usb-storage: Bulk status result = 1 usb-storage: -- transport indicates error, resetting usb-storage: storage_pre_reset The right message is: usb-storage: Command MODE_SENSE (6 bytes) usb-storage: 1a 00 3f 00 c0 00 usb-storage: Bulk Command S 0x43425355 T 0x6 L 192 F 128 Trg 0 LUN 0 CL 6 usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes usb-storage: Status code 0; transferred 31/31 usb-storage: -- transfer complete usb-storage: Bulk command transfer result=0 usb-storage: usb_stor_bulk_transfer_sglist: xfer 192 bytes, 1 entries usb-storage: Status code -121; transferred 4/192 usb-storage: -- short read transfer usb-storage: Bulk data transfer result 0x1 usb-storage: Attempting to get CSW... usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes usb-storage: Status code -32; transferred 0/13 usb-storage: clearing endpoint halt for pipe 0xc0010280 usb-storage: usb_stor_control_msg: rq=01 rqtype=02 value=0000 index=82 len=0 usb-storage: usb_stor_clear_halt: result = 0 usb-storage: Attempting to get CSW (2nd try)... usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes usb-storage: Status code 0; transferred 13/13 usb-storage: -- transfer complete Signed-off-by: Bryan Wu Signed-off-by: Tony Lindgren --- drivers/usb/musb/musb_host.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index e9c766f06a2..fa335adac04 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c @@ -422,7 +422,11 @@ musb_advance_schedule(struct musb *musb, struct urb *urb, qh = hw_ep->in_qh; else qh = hw_ep->out_qh; - qh = musb_giveback(qh, urb, 0); + + if (urb->status == -EINPROGRESS) + qh = musb_giveback(qh, urb, 0); + else + qh = musb_giveback(qh, urb, urb->status); if (qh && qh->is_ready && !list_empty(&qh->hep->urb_list)) { DBG(4, "... next ep%d %cX urb %p\n", -- 2.41.1