/* * DCP status stage */ static int usbhsh_status_stage_packet_push(struct usbhsh_hpriv *hpriv, struct urb *urb, struct usbhs_pipe *pipe, gfp_t mem_flags) { struct usbhsh_request *ureq; /* This ureq will be freed on usbhsh_queue_done() */ ureq = usbhsh_ureq_alloc(hpriv, urb, mem_flags); if (unlikely(!ureq)) return -ENOMEM; if (usb_pipein(urb->pipe)) pipe->handler = &usbhs_dcp_status_stage_in_handler; else pipe->handler = &usbhs_dcp_status_stage_out_handler; usbhs_pkt_push(pipe, &ureq->pkt, usbhsh_queue_done, NULL, urb->transfer_buffer_length, 0, -1); return 0; }
static int usbhsh_queue_push(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags) { struct usbhsh_hpriv *hpriv = usbhsh_hcd_to_hpriv(hcd); struct usbhsh_ep *uep = usbhsh_ep_to_uep(urb->ep); struct usbhs_pipe *pipe = usbhsh_uep_to_pipe(uep); struct device *dev = usbhsh_hcd_to_dev(hcd); struct usbhsh_request *ureq; void *buf; int len, sequence; if (usb_pipeisoc(urb->pipe)) { dev_err(dev, "pipe iso is not supported now\n"); return -EIO; } /* this ureq will be freed on usbhsh_queue_done() */ ureq = usbhsh_ureq_alloc(hpriv, urb, mem_flags); if (unlikely(!ureq)) { dev_err(dev, "ureq alloc fail\n"); return -ENOMEM; } if (usb_pipein(urb->pipe)) pipe->handler = &usbhs_fifo_dma_pop_handler; else pipe->handler = &usbhs_fifo_dma_push_handler; buf = (void *)(urb->transfer_buffer + urb->actual_length); len = urb->transfer_buffer_length - urb->actual_length; sequence = usb_gettoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe)); dev_dbg(dev, "%s\n", __func__); usbhs_pkt_push(pipe, &ureq->pkt, usbhsh_queue_done, buf, len, (urb->transfer_flags & URB_ZERO_PACKET), sequence); usbhs_pkt_start(pipe); return 0; }
/* * queue push/pop */ static void usbhsg_queue_push(struct usbhsg_uep *uep, struct usbhsg_request *ureq) { struct usbhsg_gpriv *gpriv = usbhsg_uep_to_gpriv(uep); struct device *dev = usbhsg_gpriv_to_dev(gpriv); struct usbhs_pipe *pipe = usbhsg_uep_to_pipe(uep); struct usbhs_pkt *pkt = usbhsg_ureq_to_pkt(ureq); struct usb_request *req = &ureq->req; req->actual = 0; req->status = -EINPROGRESS; usbhs_pkt_push(pipe, pkt, uep->handler, req->buf, req->length, req->zero); dev_dbg(dev, "pipe %d : queue push (%d)\n", usbhs_pipe_number(pipe), req->length); }