Lines Matching refs:req
513 struct pxa25x_request *req;
515 req = kzalloc(sizeof(*req), gfp_flags);
516 if (!req)
519 INIT_LIST_HEAD (&req->queue);
520 return &req->req;
530 struct pxa25x_request *req;
532 req = container_of (_req, struct pxa25x_request, req);
533 WARN_ON(!list_empty (&req->queue));
534 kfree(req);
542 static void done(struct pxa25x_ep *ep, struct pxa25x_request *req, int status)
546 list_del_init(&req->queue);
548 if (likely (req->req.status == -EINPROGRESS))
549 req->req.status = status;
551 status = req->req.status;
554 DBG(DBG_VERBOSE, "complete %s req %p stat %d len %u/%u\n",
555 ep->ep.name, &req->req, status,
556 req->req.actual, req->req.length);
560 usb_gadget_giveback_request(&ep->ep, &req->req);
571 write_packet(struct pxa25x_ep *ep, struct pxa25x_request *req, unsigned max)
576 buf = req->req.buf + req->req.actual;
580 length = min(req->req.length - req->req.actual, max);
581 req->req.actual += length;
596 write_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req)
605 count = write_packet(ep, req, max);
611 if (likely(req->req.length != req->req.actual)
612 || req->req.zero)
623 req->req.length - req->req.actual, req);
635 done (ep, req, 0);
649 /* caller asserts req->pending (ep0 irq status nyet cleared); starts
663 write_ep0_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req)
669 count = write_packet(&dev->ep[0], req, EP0_FIFO_SIZE);
676 req->req.length - req->req.actual, req);
684 count = req->req.length;
685 done (ep, req, 0);
724 read_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req)
738 buf = req->req.buf + req->req.actual;
740 bufferspace = req->req.length - req->req.actual;
745 req->req.actual += min (count, bufferspace);
749 DBG(DBG_VERY_NOISY, "read %s %02x, %d bytes%s req %p %d/%d\n",
752 req, req->req.actual, req->req.length);
761 if (req->req.status != -EOVERFLOW)
764 req->req.status = -EOVERFLOW;
776 req->req.status = -EHOSTUNREACH;
782 if (is_short || req->req.actual == req->req.length) {
783 done (ep, req, 0);
801 read_ep0_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req)
806 buf = req->req.buf + req->req.actual;
807 bufferspace = req->req.length - req->req.actual;
817 if (req->req.status != -EOVERFLOW)
819 req->req.status = -EOVERFLOW;
822 req->req.actual++;
830 if (req->req.actual >= req->req.length)
842 struct pxa25x_request *req;
847 req = container_of(_req, struct pxa25x_request, req);
849 || !list_empty(&req->queue))) {
871 && req->req.length > usb_endpoint_maxp(ep->ep.desc)))
874 DBG(DBG_NOISY, "%s queue req %p, len %d buf %p\n",
890 if (write_ep0_fifo(ep, req))
891 req = NULL;
903 done(ep, req, 0);
911 && read_ep0_fifo(ep, req))) {
913 done(ep, req, 0);
914 req = NULL;
926 && write_fifo(ep, req))
927 req = NULL;
929 && read_fifo(ep, req)) {
930 req = NULL;
933 if (likely(req && ep->ep.desc))
938 if (likely(req != NULL))
939 list_add_tail(&req->queue, &ep->queue);
951 struct pxa25x_request *req;
955 req = list_entry(ep->queue.next,
958 done(ep, req, status);
969 struct pxa25x_request *req;
979 list_for_each_entry (req, &ep->queue, queue) {
980 if (&req->req == _req)
983 if (&req->req != _req) {
988 done(ep, req, -ECONNRESET);
1302 struct pxa25x_request *req;
1325 list_for_each_entry(req, &ep->queue, queue) {
1328 &req->req, req->req.actual,
1329 req->req.length, req->req.buf);
1632 struct pxa25x_request *req;
1640 req = NULL;
1642 req = list_entry(ep->queue.next, struct pxa25x_request, queue);
1810 if (req)
1811 done(ep, req, 0);
1814 if (req) {
1816 (void) write_ep0_fifo(ep, req);
1822 if (req) {
1824 if (read_ep0_fifo(ep, req))
1825 done(ep, req, 0);
1830 if (req)
1831 done(ep, req, 0);
1836 if (req)
1837 done(ep, req, 0);
1854 struct pxa25x_request *req;
1862 req = list_entry(ep->queue.next,
1865 req = NULL;
1877 if (req && likely ((udccs & UDCCS_BI_TFS) != 0))
1878 completed = write_fifo(ep, req);
1890 if (likely(req)) {
1891 completed = read_fifo(ep, req);