Lines Matching refs:desc

81 	struct usb_dmac_desc *desc;  member
196 struct usb_dmac_desc *desc = chan->desc; in usb_dmac_chan_start_sg() local
197 struct usb_dmac_sg *sg = desc->sg + index; in usb_dmac_chan_start_sg()
202 if (desc->direction == DMA_DEV_TO_MEM) in usb_dmac_chan_start_sg()
228 chan->desc = NULL; in usb_dmac_chan_start_desc()
239 chan->desc = to_usb_dmac_desc(vd); in usb_dmac_chan_start_desc()
240 chan->desc->sg_index = 0; in usb_dmac_chan_start_desc()
266 struct usb_dmac_desc *desc; in usb_dmac_desc_alloc() local
269 desc = kzalloc(struct_size(desc, sg, sg_len), gfp); in usb_dmac_desc_alloc()
270 if (!desc) in usb_dmac_desc_alloc()
273 desc->sg_allocated_len = sg_len; in usb_dmac_desc_alloc()
274 INIT_LIST_HEAD(&desc->node); in usb_dmac_desc_alloc()
277 list_add_tail(&desc->node, &chan->desc_freed); in usb_dmac_desc_alloc()
285 struct usb_dmac_desc *desc, *_desc; in usb_dmac_desc_free() local
291 list_for_each_entry_safe(desc, _desc, &list, node) { in usb_dmac_desc_free()
292 list_del(&desc->node); in usb_dmac_desc_free()
293 kfree(desc); in usb_dmac_desc_free()
301 struct usb_dmac_desc *desc = NULL; in usb_dmac_desc_get() local
306 list_for_each_entry(desc, &chan->desc_freed, node) { in usb_dmac_desc_get()
307 if (sg_len <= desc->sg_allocated_len) { in usb_dmac_desc_get()
308 list_move_tail(&desc->node, &chan->desc_got); in usb_dmac_desc_get()
310 return desc; in usb_dmac_desc_get()
319 desc = list_last_entry(&chan->desc_freed, struct usb_dmac_desc, in usb_dmac_desc_get()
321 list_move_tail(&desc->node, &chan->desc_got); in usb_dmac_desc_get()
323 return desc; in usb_dmac_desc_get()
330 struct usb_dmac_desc *desc) in usb_dmac_desc_put() argument
335 list_move_tail(&desc->node, &chan->desc_freed); in usb_dmac_desc_put()
421 struct usb_dmac_desc *desc; in usb_dmac_prep_slave_sg() local
431 desc = usb_dmac_desc_get(uchan, sg_len, GFP_NOWAIT); in usb_dmac_prep_slave_sg()
432 if (!desc) in usb_dmac_prep_slave_sg()
435 desc->direction = dir; in usb_dmac_prep_slave_sg()
436 desc->sg_len = sg_len; in usb_dmac_prep_slave_sg()
438 desc->sg[i].mem_addr = sg_dma_address(sg); in usb_dmac_prep_slave_sg()
439 desc->sg[i].size = sg_dma_len(sg); in usb_dmac_prep_slave_sg()
442 return vchan_tx_prep(&uchan->vc, &desc->vd, dma_flags); in usb_dmac_prep_slave_sg()
448 struct usb_dmac_desc *desc, *_desc; in usb_dmac_chan_terminate_all() local
456 if (uchan->desc) in usb_dmac_chan_terminate_all()
457 uchan->desc = NULL; in usb_dmac_chan_terminate_all()
459 list_for_each_entry_safe(desc, _desc, &list, node) in usb_dmac_chan_terminate_all()
460 list_move_tail(&desc->node, &uchan->desc_freed); in usb_dmac_chan_terminate_all()
468 struct usb_dmac_desc *desc, in usb_dmac_get_current_residue() argument
471 struct usb_dmac_sg *sg = desc->sg + sg_index; in usb_dmac_get_current_residue()
479 if (desc->direction == DMA_DEV_TO_MEM) in usb_dmac_get_current_residue()
490 struct usb_dmac_desc *desc; in usb_dmac_chan_get_residue_if_complete() local
493 list_for_each_entry_reverse(desc, &chan->desc_freed, node) { in usb_dmac_chan_get_residue_if_complete()
494 if (desc->done_cookie == cookie) { in usb_dmac_chan_get_residue_if_complete()
495 residue = desc->residue; in usb_dmac_chan_get_residue_if_complete()
508 struct usb_dmac_desc *desc = chan->desc; in usb_dmac_chan_get_residue() local
511 if (!desc) { in usb_dmac_chan_get_residue()
515 desc = to_usb_dmac_desc(vd); in usb_dmac_chan_get_residue()
519 for (i = desc->sg_index + 1; i < desc->sg_len; i++) in usb_dmac_chan_get_residue()
520 residue += desc->sg[i].size; in usb_dmac_chan_get_residue()
523 residue += usb_dmac_get_current_residue(chan, desc, desc->sg_index); in usb_dmac_chan_get_residue()
560 if (vchan_issue_pending(&uchan->vc) && !uchan->desc) in usb_dmac_issue_pending()
567 struct usb_dmac_desc *desc = to_usb_dmac_desc(vd); in usb_dmac_virt_desc_free() local
570 usb_dmac_desc_put(chan, desc); in usb_dmac_virt_desc_free()
579 struct usb_dmac_desc *desc = chan->desc; in usb_dmac_isr_transfer_end() local
581 BUG_ON(!desc); in usb_dmac_isr_transfer_end()
583 if (++desc->sg_index < desc->sg_len) { in usb_dmac_isr_transfer_end()
584 usb_dmac_chan_start_sg(chan, desc->sg_index); in usb_dmac_isr_transfer_end()
586 desc->residue = usb_dmac_get_current_residue(chan, desc, in usb_dmac_isr_transfer_end()
587 desc->sg_index - 1); in usb_dmac_isr_transfer_end()
588 desc->done_cookie = desc->vd.tx.cookie; in usb_dmac_isr_transfer_end()
589 desc->vd.tx_result.result = DMA_TRANS_NOERROR; in usb_dmac_isr_transfer_end()
590 desc->vd.tx_result.residue = desc->residue; in usb_dmac_isr_transfer_end()
591 vchan_cookie_complete(&desc->vd); in usb_dmac_isr_transfer_end()