/* iop_adma_is_complete - poll the status of an ADMA transaction @chan: ADMA channel handle @cookie: ADMA transaction identifier  */
static enum dma_status iop_adma_is_complete(struct dma_chan *chan, dma_cookie_t cookie, dma_cookie_t *done, dma_cookie_t *used)
/* iop_adma_is_complete - poll the status of an ADMA transaction @chan: ADMA channel handle @cookie: ADMA transaction identifier  */
static enum dma_status iop_adma_is_complete(struct dma_chan *chan, dma_cookie_t cookie, dma_cookie_t *done, dma_cookie_t *used)
{
	struct iop_adma_chan *iop_chan = to_iop_adma_chan(chan);
	dma_cookie_t last_used;
	dma_cookie_t last_complete;
	enum dma_status ret;
	last_used = chan->cookie;
	last_complete = iop_chan->completed_cookie;
	if (done)
		*done = last_complete;
	if (used)
		*used = last_used;
	ret = dma_async_is_complete(cookie, last_complete, last_used);
	if (ret == DMA_SUCCESS)
		return ret;
	iop_adma_slot_cleanup(iop_chan);
	last_used = chan->cookie;
	last_complete = iop_chan->completed_cookie;
	if (done)
		*done = last_complete;
	if (used)
		*used = last_used;
	return dma_async_is_complete(cookie, last_complete, last_used);
}