Re: [PATCH] USB: DWC3: Fix break from cleanup request loop

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


On 06/01/2012 07:41 PM, Sergei Shtylyov wrote:

If event status says that its last completed TRB but TRB is still owned
by HW then break from the loop, because we are not going to get correct
TRB status from trb control/size register.

Signed-off-by: Pratyush Anand<pratyush.anand@xxxxxx>
---
drivers/usb/dwc3/gadget.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 00a60bc..42622cd 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1680,6 +1680,9 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc,
struct dwc3_ep *dep,
if (s_pkt)
break;
if ((event->status& DEPEVT_STATUS_LST) &&
+ (trb->ctrl & DWC3_TRB_CTRL_HWO))
+ break;
+ if ((event->status& DEPEVT_STATUS_LST) &&
(trb->ctrl &DWC3_TRB_CTRL_LST))

Isn't it better to check the first condition only once:

	if ((event->status & DEPEVT_STATUS_LST) &&
			((trb->ctrl & DWC3_TRB_CTRL_HWO) ||
			(trb->ctrl & DWC3_TRB_CTRL_LST))

   Or even:

	if ((event->status & DEPEVT_STATUS_LST) &&
	    (trb->ctrl & (DWC3_TRB_CTRL_HWO | DWC3_TRB_CTRL_LST)))

WBR, Sergei
--
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


B and H Foto and Electronics Corp.

[Linux Media]     [Video for Linux]     [Linux Input]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Free Online Dating]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]     [More Archives]

Add to Google Powered by Linux