/* Release a DMA channel from exclusive access, similar to clk_put().  */
int kinetis_dma_ch_put(int ch)
/* Release a DMA channel from exclusive access, similar to clk_put().  */
int kinetis_dma_ch_put(int ch)
{
	unsigned long fl;
	int rv;
	if (!kinetis_dma_ch_valid(ch)) {
		rv = -EINVAL;
		goto out;
	}
	spin_lock_irqsave(&dma_ch[ch].lock, fl);
	rv = dma_ch[ch].in_use ? 0 : -EBUSY;
	dma_ch[ch].in_use = 0;
	spin_unlock_irqrestore(&dma_ch[ch].lock, fl);
out:
	return rv;
}