Lines Matching defs:contract

139 	struct sun4i_dma_contract	*contract;
153 /* A contract is a set of promises */
315 * from the next pending contract.
323 struct sun4i_dma_contract *contract = NULL;
347 /* Figure out which contract we're working with today */
351 "No pending contract found");
356 contract = to_sun4i_dma_contract(vd);
357 if (list_empty(&contract->demands)) {
358 /* The contract has been completed so mark it as such */
359 list_del(&contract->vd.node);
360 vchan_cookie_complete(&contract->vd);
362 "Empty contract found and marked complete");
364 } while (list_empty(&contract->demands));
367 promise = list_first_entry(&contract->demands,
373 vchan->contract = contract;
375 set_pchan_interrupt(priv, pchan, contract->is_cyclic, 1);
423 * Generate a promise, to be used in a normal DMA contract.
427 * promise will live in the demands list on a contract. Once it has been
429 * All linked promises will be freed when the corresponding contract is freed
490 * Generate a promise, to be used in a dedicated DMA contract.
494 * promise will live in the demands list on a contract. Once it has been
496 * All linked promises will be freed when the corresponding contract is freed
547 * Generate a contract
550 * linked lists, we need to implement SG via software. We use a contract
556 struct sun4i_dma_contract *contract;
558 contract = kzalloc(sizeof(*contract), GFP_NOWAIT);
559 if (!contract)
562 INIT_LIST_HEAD(&contract->demands);
563 INIT_LIST_HEAD(&contract->completed_demands);
565 return contract;
572 * loop. This function returns the next promise from a cyclic contract,
576 get_next_cyclic_promise(struct sun4i_dma_contract *contract)
580 promise = list_first_entry_or_null(&contract->demands,
583 list_splice_init(&contract->completed_demands,
584 &contract->demands);
585 promise = list_first_entry(&contract->demands,
593 * Free a contract and all its associated promises
597 struct sun4i_dma_contract *contract = to_sun4i_dma_contract(vd);
601 list_for_each_entry_safe(promise, tmp, &contract->demands, list)
604 list_for_each_entry_safe(promise, tmp, &contract->completed_demands, list)
607 kfree(contract);
617 struct sun4i_dma_contract *contract;
619 contract = generate_dma_contract();
620 if (!contract)
640 kfree(contract);
653 /* Fill the contract with our only promise */
654 list_add_tail(&promise->list, &contract->demands);
657 return vchan_tx_prep(&vchan->vc, &contract->vd, flags);
668 struct sun4i_dma_contract *contract;
679 contract = generate_dma_contract();
680 if (!contract)
683 contract->is_cyclic = 1;
763 /* Then add it to the contract */
764 list_add_tail(&promise->list, &contract->demands);
768 return vchan_tx_prep(&vchan->vc, &contract->vd, flags);
779 struct sun4i_dma_contract *contract;
794 contract = generate_dma_contract();
795 if (!contract)
856 /* Then add it to the contract */
857 list_add_tail(&promise->list, &contract->demands);
861 * Once we've got all the promises ready, add the contract
864 return vchan_tx_prep(&vchan->vc, &contract->vd, flags);
949 struct sun4i_dma_contract *contract;
964 contract = to_sun4i_dma_contract(vd);
966 list_for_each_entry(promise, &contract->demands, list)
974 promise = list_first_entry_or_null(&contract->demands,
1015 struct sun4i_dma_contract *contract;
1032 contract = vchan->contract;
1047 &contract->completed_demands);
1062 if (contract->is_cyclic) {
1063 promise = get_next_cyclic_promise(contract);
1066 vchan_cyclic_callback(&contract->vd);
1079 if (contract->is_cyclic)
1080 vchan_cyclic_callback(&contract->vd);