[PATCH 104/108] staging: comedi: addi_apci_3120: move apci3120_interrupt_dma() to driver

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

 



Move this function from the included source file to the main driver
source file.

Remove the now empty included source file.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 .../comedi/drivers/addi-data/hwdrv_apci3120.c      | 58 ----------------------
 drivers/staging/comedi/drivers/addi_apci_3120.c    | 53 +++++++++++++++++++-
 2 files changed, 52 insertions(+), 59 deletions(-)
 delete mode 100644 drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
deleted file mode 100644
index c600871..0000000
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * This is a handler for the DMA interrupt.
- * This function copies the data to Comedi Buffer.
- * For continuous DMA it reinitializes the DMA operation.
- * For single mode DMA it stop the acquisition.
- */
-static void apci3120_interrupt_dma(int irq, void *d)
-{
-	struct comedi_device *dev = d;
-	struct apci3120_private *devpriv = dev->private;
-	struct comedi_subdevice *s = dev->read_subdev;
-	struct comedi_async *async = s->async;
-	struct comedi_cmd *cmd = &async->cmd;
-	struct apci3120_dmabuf *dmabuf;
-	unsigned int nbytes;
-	unsigned int nsamples;
-
-	dmabuf = &devpriv->dmabuf[devpriv->cur_dmabuf];
-
-	nbytes = dmabuf->use_size - inl(devpriv->amcc + AMCC_OP_REG_MWTC);
-
-	if (nbytes < dmabuf->use_size)
-		dev_err(dev->class_dev, "Interrupted DMA transfer!\n");
-	if (nbytes & 1) {
-		dev_err(dev->class_dev, "Odd count of bytes in DMA ring!\n");
-		async->events |= COMEDI_CB_ERROR;
-		return;
-	}
-	nsamples = comedi_bytes_to_samples(s, nbytes);
-
-	if (devpriv->use_double_buffer) {
-		struct apci3120_dmabuf *next_dmabuf;
-
-		next_dmabuf = &devpriv->dmabuf[!devpriv->cur_dmabuf];
-
-		/* start DMA on next buffer */
-		apci3120_init_dma(dev, next_dmabuf);
-	}
-
-	if (nsamples) {
-		comedi_buf_write_samples(s, dmabuf->virt, nsamples);
-
-		if (!(cmd->flags & CMDF_WAKE_EOS))
-			async->events |= COMEDI_CB_EOS;
-	}
-
-	if ((async->events & COMEDI_CB_CANCEL_MASK) ||
-	    (cmd->stop_src == TRIG_COUNT && async->scans_done >= cmd->stop_arg))
-		return;
-
-	if (devpriv->use_double_buffer) {
-		/* switch dma buffers for next interrupt */
-		devpriv->cur_dmabuf = !devpriv->cur_dmabuf;
-	} else {
-		/* restart DMA if is not using double buffering */
-		apci3120_init_dma(dev, dmabuf);
-	}
-}
diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c
index fce177b..9bdd727 100644
--- a/drivers/staging/comedi/drivers/addi_apci_3120.c
+++ b/drivers/staging/comedi/drivers/addi_apci_3120.c
@@ -435,7 +435,58 @@ static void apci3120_set_chanlist(struct comedi_device *dev,
 		devpriv->mode |= APCI3120_MODE_SCAN_ENA;
 }
 
-#include "addi-data/hwdrv_apci3120.c"
+static void apci3120_interrupt_dma(int irq, void *d)
+{
+	struct comedi_device *dev = d;
+	struct apci3120_private *devpriv = dev->private;
+	struct comedi_subdevice *s = dev->read_subdev;
+	struct comedi_async *async = s->async;
+	struct comedi_cmd *cmd = &async->cmd;
+	struct apci3120_dmabuf *dmabuf;
+	unsigned int nbytes;
+	unsigned int nsamples;
+
+	dmabuf = &devpriv->dmabuf[devpriv->cur_dmabuf];
+
+	nbytes = dmabuf->use_size - inl(devpriv->amcc + AMCC_OP_REG_MWTC);
+
+	if (nbytes < dmabuf->use_size)
+		dev_err(dev->class_dev, "Interrupted DMA transfer!\n");
+	if (nbytes & 1) {
+		dev_err(dev->class_dev, "Odd count of bytes in DMA ring!\n");
+		async->events |= COMEDI_CB_ERROR;
+		return;
+	}
+	nsamples = comedi_bytes_to_samples(s, nbytes);
+
+	if (devpriv->use_double_buffer) {
+		struct apci3120_dmabuf *next_dmabuf;
+
+		next_dmabuf = &devpriv->dmabuf[!devpriv->cur_dmabuf];
+
+		/* start DMA on next buffer */
+		apci3120_init_dma(dev, next_dmabuf);
+	}
+
+	if (nsamples) {
+		comedi_buf_write_samples(s, dmabuf->virt, nsamples);
+
+		if (!(cmd->flags & CMDF_WAKE_EOS))
+			async->events |= COMEDI_CB_EOS;
+	}
+
+	if ((async->events & COMEDI_CB_CANCEL_MASK) ||
+	    (cmd->stop_src == TRIG_COUNT && async->scans_done >= cmd->stop_arg))
+		return;
+
+	if (devpriv->use_double_buffer) {
+		/* switch dma buffers for next interrupt */
+		devpriv->cur_dmabuf = !devpriv->cur_dmabuf;
+	} else {
+		/* restart DMA if is not using double buffering */
+		apci3120_init_dma(dev, dmabuf);
+	}
+}
 
 static irqreturn_t apci3120_interrupt(int irq, void *d)
 {
-- 
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