summaryrefslogtreecommitdiff
path: root/drivers/usb/dwc3/gadget.c
diff options
context:
space:
mode:
authorFelipe Balbi <felipe.balbi@linux.intel.com>2017-01-05 14:32:02 +0200
committerFelipe Balbi <felipe.balbi@linux.intel.com>2017-01-24 11:04:12 +0200
commit843053093f4708fd2ee93cc6591f31bb260bb8a6 (patch)
tree2ed0600705349580d8cafa20019b07e87c05aa96 /drivers/usb/dwc3/gadget.c
parent88f950a69174eca60d3e7df558ecb53d6d4d4e6f (diff)
usb: dwc3: gadget: simplify dwc3_prepare_one_trb()
We are already passing struct dwc3_request * to dwc3_prepare_one_trb(), because of that there's no need to extract dma address and length in the caller. We can let dwc3_prepare_one_trb() itself handle that part. This simplifies the prototype of the function by removing two arguments. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb/dwc3/gadget.c')
-rw-r--r--drivers/usb/dwc3/gadget.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 204c754cc647..cd410a720aa2 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -839,13 +839,14 @@ static u32 dwc3_calc_trbs_left(struct dwc3_ep *dep);
* @req: dwc3_request pointer
*/
static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
- struct dwc3_request *req, dma_addr_t dma,
- unsigned length, unsigned chain, unsigned node)
+ struct dwc3_request *req, unsigned chain, unsigned node)
{
struct dwc3_trb *trb;
struct dwc3 *dwc = dep->dwc;
struct usb_gadget *gadget = &dwc->gadget;
enum usb_device_speed speed = gadget->speed;
+ unsigned length = req->request.length;
+ dma_addr_t dma = req->request.dma;
trb = &dep->trb_pool[dep->trb_enqueue];
@@ -974,21 +975,15 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep,
{
struct scatterlist *sg = req->sg;
struct scatterlist *s;
- unsigned int length;
- dma_addr_t dma;
int i;
for_each_sg(sg, s, req->num_pending_sgs, i) {
unsigned chain = true;
- length = sg_dma_len(s);
- dma = sg_dma_address(s);
-
if (sg_is_last(s))
chain = false;
- dwc3_prepare_one_trb(dep, req, dma, length,
- chain, i);
+ dwc3_prepare_one_trb(dep, req, chain, i);
if (!dwc3_calc_trbs_left(dep))
break;
@@ -998,14 +993,7 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep,
static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep,
struct dwc3_request *req)
{
- unsigned int length;
- dma_addr_t dma;
-
- dma = req->request.dma;
- length = req->request.length;
-
- dwc3_prepare_one_trb(dep, req, dma, length,
- false, 0);
+ dwc3_prepare_one_trb(dep, req, false, 0);
}
/*