21 #include <linux/slab.h>
32 usb_pipedevice(urb->pipe), vdev->
devid);
37 pdup->
base.direction = usb_pipein(urb->pipe) ?
39 pdup->
base.ep = usb_pipeendpoint(urb->pipe);
43 if (urb->setup_packet)
56 spin_unlock_irqrestore(&vdev->
priv_lock, flags);
60 spin_unlock_irqrestore(&vdev->
priv_lock, flags);
65 static int vhci_send_cmd_submit(
struct vhci_device *vdev)
75 while ((priv = dequeue_from_priv_tx(vdev)) !=
NULL) {
77 struct urb *urb = priv->
urb;
79 void *iso_buffer =
NULL;
82 memset(&pdu_header, 0,
sizeof(pdu_header));
84 memset(&iov, 0,
sizeof(iov));
89 setup_cmd_submit_pdu(&pdu_header, urb);
92 iov[0].iov_base = &pdu_header;
93 iov[0].iov_len =
sizeof(pdu_header);
94 txsize +=
sizeof(pdu_header);
97 if (!usb_pipein(urb->pipe) && urb->transfer_buffer_length > 0) {
98 iov[1].iov_base = urb->transfer_buffer;
99 iov[1].iov_len = urb->transfer_buffer_length;
100 txsize += urb->transfer_buffer_length;
104 if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) {
114 iov[2].iov_base = iso_buffer;
115 iov[2].iov_len = len;
121 pr_err(
"sendmsg failed!, ret=%d for %zd\n", ret,
131 total_size += txsize;
146 spin_unlock_irqrestore(&vdev->
priv_lock, flags);
150 spin_unlock_irqrestore(&vdev->
priv_lock, flags);
155 static int vhci_send_cmd_unlink(
struct vhci_device *vdev)
163 size_t total_size = 0;
165 while ((unlink = dequeue_from_unlink_tx(vdev)) !=
NULL) {
170 memset(&pdu_header, 0,
sizeof(pdu_header));
172 memset(&iov, 0,
sizeof(iov));
178 pdu_header.base.seqnum = unlink->
seqnum;
179 pdu_header.base.devid = vdev->
devid;
180 pdu_header.base.ep = 0;
185 iov[0].iov_base = &pdu_header;
186 iov[0].iov_len =
sizeof(pdu_header);
187 txsize +=
sizeof(pdu_header);
191 pr_err(
"sendmsg failed!, ret=%d for %zd\n", ret,
199 total_size += txsize;
211 if (vhci_send_cmd_submit(vdev) < 0)
214 if (vhci_send_cmd_unlink(vdev) < 0)
218 (!list_empty(&vdev->
priv_tx) ||