Lines Matching refs:desc

71  * @desc: the current descriptor
81 struct usb_dmac_desc *desc;
196 struct usb_dmac_desc *desc = chan->desc;
197 struct usb_dmac_sg *sg = desc->sg + index;
202 if (desc->direction == DMA_DEV_TO_MEM)
228 chan->desc = NULL;
239 chan->desc = to_usb_dmac_desc(vd);
240 chan->desc->sg_index = 0;
266 struct usb_dmac_desc *desc;
269 desc = kzalloc(struct_size(desc, sg, sg_len), gfp);
270 if (!desc)
273 desc->sg_allocated_len = sg_len;
274 INIT_LIST_HEAD(&desc->node);
277 list_add_tail(&desc->node, &chan->desc_freed);
285 struct usb_dmac_desc *desc, *_desc;
291 list_for_each_entry_safe(desc, _desc, &list, node) {
292 list_del(&desc->node);
293 kfree(desc);
301 struct usb_dmac_desc *desc = NULL;
306 list_for_each_entry(desc, &chan->desc_freed, node) {
307 if (sg_len <= desc->sg_allocated_len) {
308 list_move_tail(&desc->node, &chan->desc_got);
310 return desc;
317 /* If allocated the desc, it was added to tail of the list */
319 desc = list_last_entry(&chan->desc_freed, struct usb_dmac_desc,
321 list_move_tail(&desc->node, &chan->desc_got);
323 return desc;
330 struct usb_dmac_desc *desc)
335 list_move_tail(&desc->node, &chan->desc_freed);
421 struct usb_dmac_desc *desc;
431 desc = usb_dmac_desc_get(uchan, sg_len, GFP_NOWAIT);
432 if (!desc)
435 desc->direction = dir;
436 desc->sg_len = sg_len;
438 desc->sg[i].mem_addr = sg_dma_address(sg);
439 desc->sg[i].size = sg_dma_len(sg);
442 return vchan_tx_prep(&uchan->vc, &desc->vd, dma_flags);
448 struct usb_dmac_desc *desc, *_desc;
456 if (uchan->desc)
457 uchan->desc = NULL;
459 list_for_each_entry_safe(desc, _desc, &list, node)
460 list_move_tail(&desc->node, &uchan->desc_freed);
468 struct usb_dmac_desc *desc,
471 struct usb_dmac_sg *sg = desc->sg + sg_index;
479 if (desc->direction == DMA_DEV_TO_MEM)
490 struct usb_dmac_desc *desc;
493 list_for_each_entry_reverse(desc, &chan->desc_freed, node) {
494 if (desc->done_cookie == cookie) {
495 residue = desc->residue;
508 struct usb_dmac_desc *desc = chan->desc;
511 if (!desc) {
515 desc = to_usb_dmac_desc(vd);
519 for (i = desc->sg_index + 1; i < desc->sg_len; i++)
520 residue += desc->sg[i].size;
523 residue += usb_dmac_get_current_residue(chan, desc, desc->sg_index);
560 if (vchan_issue_pending(&uchan->vc) && !uchan->desc)
567 struct usb_dmac_desc *desc = to_usb_dmac_desc(vd);
570 usb_dmac_desc_put(chan, desc);
579 struct usb_dmac_desc *desc = chan->desc;
581 BUG_ON(!desc);
583 if (++desc->sg_index < desc->sg_len) {
584 usb_dmac_chan_start_sg(chan, desc->sg_index);
586 desc->residue = usb_dmac_get_current_residue(chan, desc,
587 desc->sg_index - 1);
588 desc->done_cookie = desc->vd.tx.cookie;
589 desc->vd.tx_result.result = DMA_TRANS_NOERROR;
590 desc->vd.tx_result.residue = desc->residue;
591 vchan_cookie_complete(&desc->vd);
593 /* Restart the next transfer if this driver has a next desc */