Lines Matching refs:cmd
49 struct ar5523_tx_cmd *cmd) in ar5523_read_reply() argument
75 if (cmd->odata) { in ar5523_read_reply()
76 if (cmd->olen < olen) { in ar5523_read_reply()
78 cmd->olen, olen); in ar5523_read_reply()
79 cmd->olen = 0; in ar5523_read_reply()
80 cmd->res = -EOVERFLOW; in ar5523_read_reply()
82 cmd->olen = olen; in ar5523_read_reply()
83 memcpy(cmd->odata, &rp[1], olen); in ar5523_read_reply()
84 cmd->res = 0; in ar5523_read_reply()
89 complete(&cmd->done); in ar5523_read_reply()
95 struct ar5523_tx_cmd *cmd = &ar->tx_cmd; in ar5523_cmd_rx_cb() local
125 ar5523_read_reply(ar, hdr, cmd); in ar5523_cmd_rx_cb()
130 cmd->res = 0; in ar5523_cmd_rx_cb()
131 cmd->olen = 0; in ar5523_cmd_rx_cb()
132 complete(&cmd->done); in ar5523_cmd_rx_cb()
156 if (!cmd->odata) { in ar5523_cmd_rx_cb()
160 memcpy(cmd->odata, hdr + 1, sizeof(u32)); in ar5523_cmd_rx_cb()
161 cmd->olen = sizeof(u32); in ar5523_cmd_rx_cb()
162 cmd->res = 0; in ar5523_cmd_rx_cb()
163 complete(&cmd->done); in ar5523_cmd_rx_cb()
227 struct ar5523_tx_cmd *cmd = urb->context; in ar5523_cmd_tx_cb() local
228 struct ar5523 *ar = cmd->ar; in ar5523_cmd_tx_cb()
233 cmd->res = urb->status; in ar5523_cmd_tx_cb()
234 complete(&cmd->done); in ar5523_cmd_tx_cb()
238 if (!(cmd->flags & AR5523_CMD_FLAG_READ)) { in ar5523_cmd_tx_cb()
239 cmd->res = 0; in ar5523_cmd_tx_cb()
240 complete(&cmd->done); in ar5523_cmd_tx_cb()
253 struct ar5523_tx_cmd *cmd = &ar->tx_cmd; in ar5523_cmd() local
259 hdr = (struct ar5523_cmd_hdr *)cmd->buf_tx; in ar5523_cmd()
270 cmd->odata = odata; in ar5523_cmd()
271 cmd->olen = olen; in ar5523_cmd()
272 cmd->flags = flags; in ar5523_cmd()
276 usb_fill_bulk_urb(cmd->urb_tx, ar->dev, ar5523_cmd_tx_pipe(ar->dev), in ar5523_cmd()
277 cmd->buf_tx, xferlen, ar5523_cmd_tx_cb, cmd); in ar5523_cmd()
278 cmd->urb_tx->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; in ar5523_cmd()
280 error = usb_submit_urb(cmd->urb_tx, GFP_KERNEL); in ar5523_cmd()
287 if (!wait_for_completion_timeout(&cmd->done, 2 * HZ)) { in ar5523_cmd()
289 cmd->odata = NULL; in ar5523_cmd()
292 cmd->res = -ETIMEDOUT; in ar5523_cmd()
294 return cmd->res; in ar5523_cmd()
945 struct ar5523_tx_cmd *cmd = &ar->tx_cmd; in ar5523_free_tx_cmd() local
947 usb_free_coherent(ar->dev, AR5523_MAX_RXCMDSZ, cmd->buf_tx, in ar5523_free_tx_cmd()
948 cmd->urb_tx->transfer_dma); in ar5523_free_tx_cmd()
949 usb_free_urb(cmd->urb_tx); in ar5523_free_tx_cmd()
954 struct ar5523_tx_cmd *cmd = &ar->tx_cmd; in ar5523_alloc_tx_cmd() local
956 cmd->ar = ar; in ar5523_alloc_tx_cmd()
957 init_completion(&cmd->done); in ar5523_alloc_tx_cmd()
959 cmd->urb_tx = usb_alloc_urb(0, GFP_KERNEL); in ar5523_alloc_tx_cmd()
960 if (!cmd->urb_tx) in ar5523_alloc_tx_cmd()
962 cmd->buf_tx = usb_alloc_coherent(ar->dev, AR5523_MAX_TXCMDSZ, in ar5523_alloc_tx_cmd()
964 &cmd->urb_tx->transfer_dma); in ar5523_alloc_tx_cmd()
965 if (!cmd->buf_tx) { in ar5523_alloc_tx_cmd()
966 usb_free_urb(cmd->urb_tx); in ar5523_alloc_tx_cmd()