Lines Matching refs:req
509 struct pxa25x_request *req;
511 req = kzalloc(sizeof(*req), gfp_flags);
512 if (!req)
515 INIT_LIST_HEAD (&req->queue);
516 return &req->req;
526 struct pxa25x_request *req;
528 req = container_of (_req, struct pxa25x_request, req);
529 WARN_ON(!list_empty (&req->queue));
530 kfree(req);
538 static void done(struct pxa25x_ep *ep, struct pxa25x_request *req, int status)
542 list_del_init(&req->queue);
544 if (likely (req->req.status == -EINPROGRESS))
545 req->req.status = status;
547 status = req->req.status;
550 DBG(DBG_VERBOSE, "complete %s req %p stat %d len %u/%u\n",
551 ep->ep.name, &req->req, status,
552 req->req.actual, req->req.length);
556 usb_gadget_giveback_request(&ep->ep, &req->req);
567 write_packet(struct pxa25x_ep *ep, struct pxa25x_request *req, unsigned max)
572 buf = req->req.buf + req->req.actual;
576 length = min(req->req.length - req->req.actual, max);
577 req->req.actual += length;
592 write_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req)
601 count = write_packet(ep, req, max);
607 if (likely(req->req.length != req->req.actual)
608 || req->req.zero)
619 req->req.length - req->req.actual, req);
631 done (ep, req, 0);
645 /* caller asserts req->pending (ep0 irq status nyet cleared); starts
659 write_ep0_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req)
665 count = write_packet(&dev->ep[0], req, EP0_FIFO_SIZE);
672 req->req.length - req->req.actual, req);
680 count = req->req.length;
681 done (ep, req, 0);
720 read_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req)
734 buf = req->req.buf + req->req.actual;
736 bufferspace = req->req.length - req->req.actual;
741 req->req.actual += min (count, bufferspace);
745 DBG(DBG_VERY_NOISY, "read %s %02x, %d bytes%s req %p %d/%d\n",
748 req, req->req.actual, req->req.length);
757 if (req->req.status != -EOVERFLOW)
760 req->req.status = -EOVERFLOW;
772 req->req.status = -EHOSTUNREACH;
778 if (is_short || req->req.actual == req->req.length) {
779 done (ep, req, 0);
797 read_ep0_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req)
802 buf = req->req.buf + req->req.actual;
803 bufferspace = req->req.length - req->req.actual;
813 if (req->req.status != -EOVERFLOW)
815 req->req.status = -EOVERFLOW;
818 req->req.actual++;
826 if (req->req.actual >= req->req.length)
838 struct pxa25x_request *req;
843 req = container_of(_req, struct pxa25x_request, req);
845 || !list_empty(&req->queue))) {
867 && req->req.length > usb_endpoint_maxp(ep->ep.desc)))
870 DBG(DBG_NOISY, "%s queue req %p, len %d buf %p\n",
886 if (write_ep0_fifo(ep, req))
887 req = NULL;
899 done(ep, req, 0);
907 && read_ep0_fifo(ep, req))) {
909 done(ep, req, 0);
910 req = NULL;
922 && write_fifo(ep, req))
923 req = NULL;
925 && read_fifo(ep, req)) {
926 req = NULL;
929 if (likely(req && ep->ep.desc))
934 if (likely(req != NULL))
935 list_add_tail(&req->queue, &ep->queue);
947 struct pxa25x_request *req;
951 req = list_entry(ep->queue.next,
954 done(ep, req, status);
965 struct pxa25x_request *req = NULL;
977 if (&iter->req != _req)
979 req = iter;
982 if (!req) {
987 done(ep, req, -ECONNRESET);
1301 struct pxa25x_request *req;
1324 list_for_each_entry(req, &ep->queue, queue) {
1327 &req->req, req->req.actual,
1328 req->req.length, req->req.buf);
1594 struct pxa25x_request *req;
1602 req = NULL;
1604 req = list_entry(ep->queue.next, struct pxa25x_request, queue);
1772 if (req)
1773 done(ep, req, 0);
1776 if (req) {
1778 (void) write_ep0_fifo(ep, req);
1784 if (req) {
1786 if (read_ep0_fifo(ep, req))
1787 done(ep, req, 0);
1792 if (req)
1793 done(ep, req, 0);
1798 if (req)
1799 done(ep, req, 0);
1816 struct pxa25x_request *req;
1824 req = list_entry(ep->queue.next,
1827 req = NULL;
1839 if (req && likely ((udccs & UDCCS_BI_TFS) != 0))
1840 completed = write_fifo(ep, req);
1852 if (likely(req)) {
1853 completed = read_fifo(ep, req);