Lines Matching refs:req

37 static inline struct dwc2_hsotg_req *our_req(struct usb_request *req)
39 return container_of(req, struct dwc2_hsotg_req, req);
399 struct dwc2_hsotg_req *req;
401 req = kzalloc(sizeof(*req), flags);
402 if (!req)
405 INIT_LIST_HEAD(&req->queue);
407 return &req->req;
435 struct usb_request *req = &hs_req->req;
437 usb_gadget_unmap_request(&hsotg->gadget, req, hs_ep->map_dir);
510 int buf_pos = hs_req->req.actual;
642 to_write, hs_req->req.length, can_write, buf_pos);
647 hs_req->req.actual = buf_pos + to_write;
654 data = hs_req->req.buf + buf_pos;
878 if (hs_ep->req)
879 ureq = &hs_ep->req->req;
1009 dma_addr_t dma_addr = hs_req->req.dma;
1011 if (hs_req->req.num_sgs) {
1012 WARN_ON(hs_req->req.num_sgs > 1);
1013 dma_addr = sg_dma_address(hs_req->req.sg);
1016 hs_req->req.length);
1054 struct usb_request *ureq = &hs_req->req;
1067 if (hs_ep->req && !continuing) {
1071 } else if (hs_ep->req != hs_req && continuing) {
1073 "%s: continue different req\n", __func__);
1107 dev_dbg(hsotg->dev, "%s: length %d, max-req %d, r %d\n",
1148 hs_ep->req = hs_req;
1201 hs_req->req.frame_number = hs_ep->target_frame;
1202 hs_req->req.actual = 0;
1256 * @req: The request being processed.
1266 struct usb_request *req)
1271 ret = usb_gadget_map_request(&hsotg->gadget, req, hs_ep->dir_in);
1279 __func__, req->buf, req->length);
1288 void *req_buf = hs_req->req.buf;
1297 hs_ep->ep.name, req_buf, hs_req->req.length);
1299 hs_req->req.buf = kmalloc(hs_req->req.length, GFP_ATOMIC);
1300 if (!hs_req->req.buf) {
1301 hs_req->req.buf = req_buf;
1312 memcpy(hs_req->req.buf, req_buf, hs_req->req.length);
1326 hs_ep->ep.name, hs_req->req.status, hs_req->req.actual);
1329 if (!hs_ep->dir_in && !hs_req->req.status)
1330 memcpy(hs_req->saved_req_buf, hs_req->req.buf,
1331 hs_req->req.actual);
1334 kfree(hs_req->req.buf);
1336 hs_req->req.buf = hs_req->saved_req_buf;
1403 static int dwc2_hsotg_ep_queue(struct usb_ep *ep, struct usb_request *req,
1406 struct dwc2_hsotg_req *hs_req = our_req(req);
1415 dev_dbg(hs->dev, "%s: req %p: %d@%p, noi=%d, zero=%d, snok=%d\n",
1416 ep->name, req, req->length, req->buf, req->no_interrupt,
1417 req->zero, req->short_not_ok);
1428 req->actual = 0;
1429 req->status = -EINPROGRESS;
1433 req->length > (hs_ep->mc * hs_ep->ep.maxpacket)) {
1434 dev_err(hs->dev, "req length > maxpacket*mc\n");
1443 if (hs_ep->dir_in && req->length > maxsize) {
1445 req->length, maxsize);
1449 if (!hs_ep->dir_in && req->length > hs_ep->ep.maxpacket) {
1451 req->length, hs_ep->ep.maxpacket);
1462 ret = dwc2_hsotg_map_dma(hs, hs_ep, req);
1484 dma_addr_t dma_addr = hs_req->req.dma;
1486 if (hs_req->req.num_sgs) {
1487 WARN_ON(hs_req->req.num_sgs > 1);
1488 dma_addr = sg_dma_address(hs_req->req.sg);
1491 hs_req->req.length);
1497 if (!hs_ep->index && !req->length && !hs_ep->dir_in &&
1523 static int dwc2_hsotg_ep_queue_lock(struct usb_ep *ep, struct usb_request *req,
1532 ret = dwc2_hsotg_ep_queue(ep, req, gfp_flags);
1539 struct usb_request *req)
1541 struct dwc2_hsotg_req *hs_req = our_req(req);
1549 * @req: The request completed.
1555 struct usb_request *req)
1560 dev_dbg(hsotg->dev, "%s: ep %p, req %p\n", __func__, ep, req);
1562 dwc2_hsotg_ep_free_request(ep, req);
1629 struct usb_request *req;
1634 req = dwc2_hsotg_ep_alloc_request(&ep->ep, GFP_ATOMIC);
1635 hsotg->ep0_reply = req;
1636 if (!req) {
1637 dev_warn(hsotg->dev, "%s: cannot alloc req\n", __func__);
1641 req->buf = hsotg->ep0_buff;
1642 req->length = length;
1647 req->zero = 0;
1648 req->complete = dwc2_hsotg_complete_oursetup;
1651 memcpy(req->buf, buff, length);
1653 ret = dwc2_hsotg_ep_queue(&ep->ep, req, GFP_ATOMIC);
1655 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);
4301 struct dwc2_hsotg_req *req, *treq;
4303 list_for_each_entry_safe(req, treq, &ep->queue, queue) {
4304 if (req == test)
4314 * @req: The request to be removed from a queue.
4316 static int dwc2_hsotg_ep_dequeue(struct usb_ep *ep, struct usb_request *req)
4318 struct dwc2_hsotg_req *hs_req = our_req(req);
4323 dev_dbg(hs->dev, "ep_dequeue(%p,%p)\n", ep, req);
4333 if (req == &hs_ep->req->req)
4983 dev_err(dev, "failed to allocate ctrl req\n");