/* imx_dma_setup_handlers - setup i.MX DMA channel end and error notification handlers @channel: i.MX DMA channel number @irq_handler: the pointer to the function called if the transfer ends successfully @err_handler: the pointer to the function called if the premature end caused by error occurs @data: user specified value to be passed to the handlers  */
int imx_dma_setup_handlers(int channel, void(*irq_handler)(int, void *), void(*err_handler)(int, void *, int), void *data)
/* imx_dma_setup_handlers - setup i.MX DMA channel end and error notification handlers @channel: i.MX DMA channel number @irq_handler: the pointer to the function called if the transfer ends successfully @err_handler: the pointer to the function called if the premature end caused by error occurs @data: user specified value to be passed to the handlers  */
int imx_dma_setup_handlers(int channel, void(*irq_handler)(int, void *), void(*err_handler)(int, void *, int), void *data)
{
	struct imx_dma_channel *imxdma = &imx_dma_channels[channel];
	unsigned long flags;
	if (!imxdma->name) {
		printk(KERN_CRIT "%s: called for  not allocated channel %d\n",
		       __func__, channel);
		return -ENODEV;
	}
	local_irq_save(flags);
	__raw_writel(1 << channel, DMA_BASE + DMA_DISR);
	imxdma->irq_handler = irq_handler;
	imxdma->err_handler = err_handler;
	imxdma->data = data;
	local_irq_restore(flags);
	return 0;
}