mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-01 10:13:58 +08:00
usb: dwc3: gadget: simplify __dwc3_gadget_kick_transfer() prototype
Now that all the information we need sits in struct dwc3_ep, we can start taking only a pointer to struct dwc3_ep as an argument. This allows us to clean the code up a bit. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
This commit is contained in:
parent
502a37b98a
commit
7fdca76649
@ -1191,7 +1191,7 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep)
|
||||
}
|
||||
}
|
||||
|
||||
static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param)
|
||||
static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep)
|
||||
{
|
||||
struct dwc3_gadget_ep_cmd_params params;
|
||||
struct dwc3_request *req;
|
||||
@ -1216,8 +1216,10 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param)
|
||||
if (starting) {
|
||||
params.param0 = upper_32_bits(req->trb_dma);
|
||||
params.param1 = lower_32_bits(req->trb_dma);
|
||||
cmd = DWC3_DEPCMD_STARTTRANSFER |
|
||||
DWC3_DEPCMD_PARAM(cmd_param);
|
||||
cmd = DWC3_DEPCMD_STARTTRANSFER;
|
||||
|
||||
if (usb_endpoint_xfer_isoc(dep->endpoint.desc))
|
||||
cmd |= DWC3_DEPCMD_PARAM(dep->frame_number);
|
||||
} else {
|
||||
cmd = DWC3_DEPCMD_UPDATETRANSFER |
|
||||
DWC3_DEPCMD_PARAM(dep->resource_index);
|
||||
@ -1270,7 +1272,7 @@ static void __dwc3_gadget_start_isoc(struct dwc3 *dwc,
|
||||
* least 4 microframes.
|
||||
*/
|
||||
dep->frame_number = cur_uf + max_t(u32, 4, dep->interval);
|
||||
__dwc3_gadget_kick_transfer(dep, dep->frame_number);
|
||||
__dwc3_gadget_kick_transfer(dep);
|
||||
}
|
||||
|
||||
static void dwc3_gadget_start_isoc(struct dwc3 *dwc,
|
||||
@ -1340,7 +1342,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
|
||||
}
|
||||
|
||||
out:
|
||||
return __dwc3_gadget_kick_transfer(dep, 0);
|
||||
return __dwc3_gadget_kick_transfer(dep);
|
||||
}
|
||||
|
||||
static int dwc3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request,
|
||||
@ -2333,7 +2335,7 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep,
|
||||
req->request.actual = length - req->remaining;
|
||||
|
||||
if ((req->request.actual < length) && req->num_pending_sgs)
|
||||
return __dwc3_gadget_kick_transfer(dep, 0);
|
||||
return __dwc3_gadget_kick_transfer(dep);
|
||||
|
||||
dwc3_gadget_giveback(dep, req, status);
|
||||
|
||||
@ -2426,13 +2428,8 @@ static void dwc3_endpoint_transfer_complete(struct dwc3 *dwc,
|
||||
if (!dep->endpoint.desc)
|
||||
return;
|
||||
|
||||
if (!usb_endpoint_xfer_isoc(dep->endpoint.desc)) {
|
||||
int ret;
|
||||
|
||||
ret = __dwc3_gadget_kick_transfer(dep, 0);
|
||||
if (!ret || ret == -EBUSY)
|
||||
return;
|
||||
}
|
||||
if (!usb_endpoint_xfer_isoc(dep->endpoint.desc))
|
||||
__dwc3_gadget_kick_transfer(dep);
|
||||
}
|
||||
|
||||
static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
|
||||
@ -2473,15 +2470,10 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
|
||||
dwc3_endpoint_transfer_complete(dwc, dep, event);
|
||||
break;
|
||||
case DWC3_DEPEVT_XFERNOTREADY:
|
||||
if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) {
|
||||
if (usb_endpoint_xfer_isoc(dep->endpoint.desc))
|
||||
dwc3_gadget_start_isoc(dwc, dep, event);
|
||||
} else {
|
||||
int ret;
|
||||
|
||||
ret = __dwc3_gadget_kick_transfer(dep, 0);
|
||||
if (!ret || ret == -EBUSY)
|
||||
return;
|
||||
}
|
||||
else
|
||||
__dwc3_gadget_kick_transfer(dep);
|
||||
|
||||
break;
|
||||
case DWC3_DEPEVT_STREAMEVT:
|
||||
|
Loading…
Reference in New Issue
Block a user