/* The channel will NOT be released if it's marked "busy" (see mxs_dma_enable()).  */
int mxs_dma_release(int channel)
/* The channel will NOT be released if it's marked "busy" (see mxs_dma_enable()).  */
int mxs_dma_release(int channel)
{
	struct mxs_dma_chan *pchan;
	int ret;
	ret = mxs_dma_validate_chan(channel);
	if (ret)
		return ret;
	pchan = mxs_dma_channels + channel;
	if (pchan->flags & MXS_DMA_FLAGS_BUSY)
		return -EBUSY;
	pchan->dev = 0;
	pchan->active_num = 0;
	pchan->pending_num = 0;
	pchan->flags &= ~MXS_DMA_FLAGS_ALLOCATED;
	return 0;
}