Lines Matching refs:req

36 static inline struct dwc2_hsotg_req *our_req(struct usb_request *req)
38 return container_of(req, struct dwc2_hsotg_req, req);
398 struct dwc2_hsotg_req *req;
400 req = kzalloc(sizeof(*req), flags);
401 if (!req)
404 INIT_LIST_HEAD(&req->queue);
406 return &req->req;
434 struct usb_request *req = &hs_req->req;
436 usb_gadget_unmap_request(&hsotg->gadget, req, hs_ep->map_dir);
509 int buf_pos = hs_req->req.actual;
641 to_write, hs_req->req.length, can_write, buf_pos);
646 hs_req->req.actual = buf_pos + to_write;
653 data = hs_req->req.buf + buf_pos;
877 if (hs_ep->req)
878 ureq = &hs_ep->req->req;
1008 dma_addr_t dma_addr = hs_req->req.dma;
1010 if (hs_req->req.num_sgs) {
1011 WARN_ON(hs_req->req.num_sgs > 1);
1012 dma_addr = sg_dma_address(hs_req->req.sg);
1015 hs_req->req.length);
1053 struct usb_request *ureq = &hs_req->req;
1066 if (hs_ep->req && !continuing) {
1070 } else if (hs_ep->req != hs_req && continuing) {
1072 "%s: continue different req\n", __func__);
1106 dev_dbg(hsotg->dev, "%s: length %d, max-req %d, r %d\n",
1147 hs_ep->req = hs_req;
1200 hs_req->req.frame_number = hs_ep->target_frame;
1201 hs_req->req.actual = 0;
1255 * @req: The request being processed.
1265 struct usb_request *req)
1270 ret = usb_gadget_map_request(&hsotg->gadget, req, hs_ep->dir_in);
1278 __func__, req->buf, req->length);
1287 void *req_buf = hs_req->req.buf;
1296 hs_ep->ep.name, req_buf, hs_req->req.length);
1298 hs_req->req.buf = kmalloc(hs_req->req.length, GFP_ATOMIC);
1299 if (!hs_req->req.buf) {
1300 hs_req->req.buf = req_buf;
1311 memcpy(hs_req->req.buf, req_buf, hs_req->req.length);
1325 hs_ep->ep.name, hs_req->req.status, hs_req->req.actual);
1328 if (!hs_ep->dir_in && !hs_req->req.status)
1329 memcpy(hs_req->saved_req_buf, hs_req->req.buf,
1330 hs_req->req.actual);
1333 kfree(hs_req->req.buf);
1335 hs_req->req.buf = hs_req->saved_req_buf;
1402 static int dwc2_hsotg_ep_queue(struct usb_ep *ep, struct usb_request *req,
1405 struct dwc2_hsotg_req *hs_req = our_req(req);
1414 dev_dbg(hs->dev, "%s: req %p: %d@%p, noi=%d, zero=%d, snok=%d\n",
1415 ep->name, req, req->length, req->buf, req->no_interrupt,
1416 req->zero, req->short_not_ok);
1427 req->actual = 0;
1428 req->status = -EINPROGRESS;
1432 req->length > (hs_ep->mc * hs_ep->ep.maxpacket)) {
1433 dev_err(hs->dev, "req length > maxpacket*mc\n");
1442 if (hs_ep->dir_in && req->length > maxsize) {
1444 req->length, maxsize);
1448 if (!hs_ep->dir_in && req->length > hs_ep->ep.maxpacket) {
1450 req->length, hs_ep->ep.maxpacket);
1461 ret = dwc2_hsotg_map_dma(hs, hs_ep, req);
1483 dma_addr_t dma_addr = hs_req->req.dma;
1485 if (hs_req->req.num_sgs) {
1486 WARN_ON(hs_req->req.num_sgs > 1);
1487 dma_addr = sg_dma_address(hs_req->req.sg);
1490 hs_req->req.length);
1496 if (!hs_ep->index && !req->length && !hs_ep->dir_in &&
1522 static int dwc2_hsotg_ep_queue_lock(struct usb_ep *ep, struct usb_request *req,
1531 ret = dwc2_hsotg_ep_queue(ep, req, gfp_flags);
1538 struct usb_request *req)
1540 struct dwc2_hsotg_req *hs_req = our_req(req);
1548 * @req: The request completed.
1554 struct usb_request *req)
1559 dev_dbg(hsotg->dev, "%s: ep %p, req %p\n", __func__, ep, req);
1561 dwc2_hsotg_ep_free_request(ep, req);
1628 struct usb_request *req;
1633 req = dwc2_hsotg_ep_alloc_request(&ep->ep, GFP_ATOMIC);
1634 hsotg->ep0_reply = req;
1635 if (!req) {
1636 dev_warn(hsotg->dev, "%s: cannot alloc req\n", __func__);
1640 req->buf = hsotg->ep0_buff;
1641 req->length = length;
1646 req->zero = 0;
1647 req->complete = dwc2_hsotg_complete_oursetup;
1650 memcpy(req->buf, buff, length);
1652 ret = dwc2_hsotg_ep_queue(&ep->ep, req, GFP_ATOMIC);
1654 dev_warn(hsotg->dev, "%s: cannot queue req\n", __func__);
1852 if (ep->req) {
1853 hs_req = ep->req;
1854 ep->req = NULL;
1856 if (hs_req->req.complete) {
1859 &ep->ep, &hs_req->req);
1865 if (!ep->req)
2003 * @req: The request completed.
2009 struct usb_request *req)
2014 if (req->status < 0) {
2015 dev_dbg(hsotg->dev, "%s: failed %d\n", __func__, req->status);
2020 if (req->actual == 0)
2023 dwc2_hsotg_process_control(hsotg, req->buf);
2036 struct usb_request *req = hsotg->ctrl_req;
2037 struct dwc2_hsotg_req *hs_req = our_req(req);
2042 req->zero = 0;
2043 req->length = 8;
2044 req->buf = hsotg->ctrl_buff;
2045 req->complete = dwc2_hsotg_complete_setup;
2056 ret = dwc2_hsotg_ep_queue(&hsotg->eps_out[0]->ep, req, GFP_ATOMIC);
2124 dev_dbg(hsotg->dev, "complete: ep %p %s, req %p, %d => %p\n",
2125 hs_ep, hs_ep->ep.name, hs_req, result, hs_req->req.complete);
2132 if (hs_req->req.status == -EINPROGRESS)
2133 hs_req->req.status = result;
2140 hs_ep->req = NULL;
2148 if (hs_req->req.complete) {
2150 usb_gadget_giveback_request(&hs_ep->ep, &hs_req->req);
2164 if (!hs_ep->req && result >= 0)
2196 ureq = &hs_req->req;
2262 struct dwc2_hsotg_req *hs_req = hs_ep->req;
2272 "%s: FIFO %d bytes on ep%d but no req (DXEPCTl=0x%08x)\n",
2283 read_ptr = hs_req->req.actual;
2284 max_req = hs_req->req.length - read_ptr;
2287 __func__, to_read, max_req, read_ptr, hs_req->req.length);
2300 hs_req->req.actual += to_read;
2308 hs_req->req.buf + read_ptr, to_read);
2390 struct dwc2_hsotg_req *hs_req = hs_ep->req;
2391 struct usb_request *req = &hs_req->req;
2425 req->actual = size_done;
2429 if (req->actual < req->length && size_left == 0) {
2434 if (req->actual < req->length && req->short_not_ok) {
2436 __func__, req->actual, req->length);
2454 req->frame_number = hs_ep->target_frame;
2651 struct dwc2_hsotg_req *hs_req = hs_ep->req;
2664 if (hs_req->req.actual < hs_req->req.length) {
2684 struct dwc2_hsotg_req *hs_req = hs_ep->req;
2689 dev_dbg(hsotg->dev, "XferCompl but no req\n");
2740 if (hs_req->req.actual != size_done)
2742 __func__, hs_req->req.actual, size_done);
2744 hs_req->req.actual = size_done;
2745 dev_dbg(hsotg->dev, "req->length:%d req->actual:%d req->zero:%d\n",
2746 hs_req->req.length, hs_req->req.actual, hs_req->req.zero);
2748 if (!size_left && hs_req->req.actual < hs_req->req.length) {
2749 dev_dbg(hsotg->dev, "%s trying more for req...\n", __func__);
2772 hs_req->req.frame_number = hs_ep->target_frame;
2862 hs_req->req.frame_number = hs_ep->target_frame;
2863 hs_req->req.actual = 0;
2920 hs_req->req.frame_number = ep->target_frame;
2921 hs_req->req.actual = 0;
2930 if (!ep->req)
3013 hs_req->req.frame_number = hs_ep->target_frame;
3014 hs_req->req.actual = 0;
3023 if (!hs_ep->req)
3090 if (idx == 0 && !hs_ep->req)
3288 ep->req = NULL;
3291 struct dwc2_hsotg_req *req = get_ep_head(ep);
3293 dwc2_hsotg_complete_request(hsotg, ep, req, result);
4302 struct dwc2_hsotg_req *req, *treq;
4304 list_for_each_entry_safe(req, treq, &ep->queue, queue) {
4305 if (req == test)
4315 * @req: The request to be removed from a queue.
4317 static int dwc2_hsotg_ep_dequeue(struct usb_ep *ep, struct usb_request *req)
4319 struct dwc2_hsotg_req *hs_req = our_req(req);
4324 dev_dbg(hs->dev, "ep_dequeue(%p,%p)\n", ep, req);
4334 if (req == &hs_ep->req->req)
5047 dev_err(dev, "failed to allocate ctrl req\n");