[PATCH 15/25] staging: comedi: pcl812: introduce pcl812_isadma_disable()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



According to Documentation/DMA-ISA-LPC.txt, the DMA lock needs to be
claimed before using any of the ISA DMA routines. Introduce a helper
function to disable the ISA DMA controller and add the necessary
locking calls.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/pcl812.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/pcl812.c b/drivers/staging/comedi/drivers/pcl812.c
index 6b38147..c67c2c7 100644
--- a/drivers/staging/comedi/drivers/pcl812.c
+++ b/drivers/staging/comedi/drivers/pcl812.c
@@ -547,6 +547,15 @@ static void pcl812_isadma_program(unsigned int dma_chan,
 	release_dma_lock(flags);
 }
 
+static void pcl812_isadma_disable(unsigned int dma_chan)
+{
+	unsigned long flags;
+
+	flags = claim_dma_lock();
+	disable_dma(dma_chan);
+	release_dma_lock(flags);
+}
+
 static void pcl812_start_pacer(struct comedi_device *dev, bool load_timers)
 {
 	struct pcl812_private *devpriv = dev->private;
@@ -618,7 +627,7 @@ static void pcl812_ai_setup_next_dma(struct comedi_device *dev,
 	struct pcl812_private *devpriv = dev->private;
 	struct pcl812_dma_desc *dma;
 
-	disable_dma(devpriv->dma);
+	pcl812_isadma_disable(devpriv->dma);
 
 	devpriv->cur_dma = 1 - devpriv->cur_dma;
 	dma = &devpriv->dma_desc[devpriv->cur_dma];
@@ -980,7 +989,7 @@ static int pcl812_ai_cancel(struct comedi_device *dev,
 	struct pcl812_private *devpriv = dev->private;
 
 	if (devpriv->ai_dma)
-		disable_dma(devpriv->dma);
+		pcl812_isadma_disable(devpriv->dma);
 
 	outb(devpriv->mode_reg_int | PCL812_CTRL_DISABLE_TRIG,
 	     dev->iobase + PCL812_CTRL_REG);
-- 
2.0.3

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux