Skip to content

Commit

Permalink
usb: dwc3: gadget: check for lack of TRBs a bit earlier
Browse files Browse the repository at this point in the history
This will let us call __dwc3_gadget_kick_transfer()
unconditionally. No functional changes, cleanup only.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
  • Loading branch information
Felipe Balbi committed Oct 19, 2017
1 parent f9c5d1d commit ccb94eb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/usb/dwc3/gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -1151,9 +1151,6 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep)

BUILD_BUG_ON_NOT_POWER_OF_2(DWC3_TRB_NUM);

if (!dwc3_calc_trbs_left(dep))
return;

/*
* We can get in a situation where there's a request in the started list
* but there weren't enough TRBs to fully kick it in the first time
Expand Down Expand Up @@ -1202,6 +1199,9 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param)
int ret;
u32 cmd;

if (!dwc3_calc_trbs_left(dep))
return 0;

starting = !(dep->flags & DWC3_EP_BUSY);

dwc3_prepare_trbs(dep);
Expand Down

0 comments on commit ccb94eb

Please sign in to comment.