Skip to content

Commit

Permalink
Merge tag 'fixes-for-v5.5-rc2' of git://git.kernel.org/pub/scm/linux/…
Browse files Browse the repository at this point in the history
…kernel/git/balbi/usb into usb-linus

Felipe writes:

USB: fixes for v5.5-rc2

Only four patches here this time around. Three of them are on dwc3
fixing some small bugs related to our 'started' flag.

None are major fixes but they're important nevertheless.

* tag 'fixes-for-v5.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb:
  usb: gadget: fix wrong endpoint desc
  usb: dwc3: ep0: Clear started flag on completion
  usb: dwc3: gadget: Clear started flag for non-IOC
  usb: dwc3: gadget: Fix logical condition
  • Loading branch information
Greg Kroah-Hartman committed Dec 11, 2019
2 parents f8c63ed + e5b5da9 commit 8586221
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
8 changes: 8 additions & 0 deletions drivers/usb/dwc3/ep0.c
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,9 @@ static void dwc3_ep0_xfernotready(struct dwc3 *dwc,
void dwc3_ep0_interrupt(struct dwc3 *dwc,
const struct dwc3_event_depevt *event)
{
struct dwc3_ep *dep = dwc->eps[event->endpoint_number];
u8 cmd;

switch (event->endpoint_event) {
case DWC3_DEPEVT_XFERCOMPLETE:
dwc3_ep0_xfer_complete(dwc, event);
Expand All @@ -1129,7 +1132,12 @@ void dwc3_ep0_interrupt(struct dwc3 *dwc,
case DWC3_DEPEVT_XFERINPROGRESS:
case DWC3_DEPEVT_RXTXFIFOEVT:
case DWC3_DEPEVT_STREAMEVT:
break;
case DWC3_DEPEVT_EPCMDCMPLT:
cmd = DEPEVT_PARAMETER_CMD(event->parameters);

if (cmd == DWC3_DEPCMD_ENDTRANSFER)
dep->flags &= ~DWC3_EP_TRANSFER_STARTED;
break;
}
}
5 changes: 4 additions & 1 deletion drivers/usb/dwc3/gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -2491,7 +2491,7 @@ static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep,

req->request.actual = req->request.length - req->remaining;

if (!dwc3_gadget_ep_request_completed(req) &&
if (!dwc3_gadget_ep_request_completed(req) ||
req->num_pending_sgs) {
__dwc3_gadget_kick_transfer(dep);
goto out;
Expand Down Expand Up @@ -2719,6 +2719,9 @@ static void dwc3_stop_active_transfer(struct dwc3_ep *dep, bool force,
WARN_ON_ONCE(ret);
dep->resource_index = 0;

if (!interrupt)
dep->flags &= ~DWC3_EP_TRANSFER_STARTED;

if (dwc3_is_usb31(dwc) || dwc->revision < DWC3_REVISION_310A)
udelay(100);
}
Expand Down
6 changes: 5 additions & 1 deletion drivers/usb/gadget/function/f_ecm.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,8 +621,12 @@ static void ecm_disable(struct usb_function *f)

DBG(cdev, "ecm deactivated\n");

if (ecm->port.in_ep->enabled)
if (ecm->port.in_ep->enabled) {
gether_disconnect(&ecm->port);
} else {
ecm->port.in_ep->desc = NULL;
ecm->port.out_ep->desc = NULL;
}

usb_ep_disable(ecm->notify);
ecm->notify->desc = NULL;
Expand Down
1 change: 1 addition & 0 deletions drivers/usb/gadget/function/f_rndis.c
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,7 @@ static void rndis_disable(struct usb_function *f)
gether_disconnect(&rndis->port);

usb_ep_disable(rndis->notify);
rndis->notify->desc = NULL;
}

/*-------------------------------------------------------------------------*/
Expand Down

0 comments on commit 8586221

Please sign in to comment.