[PATCH 07/17] staging: comedi: quatech_daqp_cs: remove 'interrupt_mode'

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

 



The interrupt handler is now only used for the ai async command.
Remove the unnecessary 'interrupt_mode' from the private data and
tidy up the interrupt handler.

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

diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c
index f337833..d2e9049 100644
--- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c
+++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c
@@ -55,8 +55,6 @@ struct daqp_private {
 	unsigned int pacer_div;
 	unsigned char scanrate;
 	int stop;
-
-	enum { semaphore, buffer } interrupt_mode;
 };
 
 /* The DAQP communicates with the system through a 16 byte I/O window. */
@@ -168,15 +166,12 @@ static int daqp_ai_cancel(struct comedi_device *dev,
 	outb(0, dev->iobase + DAQP_CONTROL);
 	inb(dev->iobase + DAQP_STATUS);
 
-	devpriv->interrupt_mode = semaphore;
-
 	return 0;
 }
 
-static enum irqreturn daqp_interrupt(int irq, void *dev_id)
+static irqreturn_t daqp_interrupt(int irq, void *dev_id)
 {
 	struct comedi_device *dev = dev_id;
-	struct daqp_private *devpriv = dev->private;
 	struct comedi_subdevice *s = dev->read_subdev;
 	struct comedi_cmd *cmd = &s->async->cmd;
 	int loop_limit = 10000;
@@ -185,49 +180,42 @@ static enum irqreturn daqp_interrupt(int irq, void *dev_id)
 	if (!dev->attached)
 		return IRQ_NONE;
 
-	switch (devpriv->interrupt_mode) {
-	case semaphore:
-		break;
+	status = inb(dev->iobase + DAQP_STATUS);
+	while (!(status & DAQP_STATUS_FIFO_EMPTY)) {
+		unsigned short data;
 
-	case buffer:
-		while (!((status = inb(dev->iobase + DAQP_STATUS))
-			 & DAQP_STATUS_FIFO_EMPTY)) {
-			unsigned short data;
+		if (status & DAQP_STATUS_DATA_LOST) {
+			s->async->events |= COMEDI_CB_OVERFLOW;
+			dev_warn(dev->class_dev, "data lost\n");
+			break;
+		}
 
-			if (status & DAQP_STATUS_DATA_LOST) {
-				s->async->events |= COMEDI_CB_OVERFLOW;
-				dev_warn(dev->class_dev, "data lost\n");
-				break;
-			}
+		data = inb(dev->iobase + DAQP_FIFO);
+		data |= inb(dev->iobase + DAQP_FIFO) << 8;
+		data ^= 0x8000;
 
-			data = inb(dev->iobase + DAQP_FIFO);
-			data |= inb(dev->iobase + DAQP_FIFO) << 8;
-			data ^= 0x8000;
+		comedi_buf_write_samples(s, &data, 1);
 
-			comedi_buf_write_samples(s, &data, 1);
+		if (cmd->stop_src == TRIG_COUNT &&
+		    s->async->scans_done >= cmd->stop_arg) {
+			s->async->events |= COMEDI_CB_EOA;
+			break;
+		}
 
-			/* If there's a limit, decrement it
-			 * and stop conversion if zero
-			 */
+		if ((loop_limit--) <= 0)
+			break;
 
-			if (cmd->stop_src == TRIG_COUNT &&
-			    s->async->scans_done >= cmd->stop_arg) {
-				s->async->events |= COMEDI_CB_EOA;
-				break;
-			}
+		status = inb(dev->iobase + DAQP_STATUS);
+	}
 
-			if ((loop_limit--) <= 0)
-				break;
-		}
+	if (loop_limit <= 0) {
+		dev_warn(dev->class_dev,
+			 "loop_limit reached in daqp_interrupt()\n");
+		s->async->events |= COMEDI_CB_ERROR;
+	}
 
-		if (loop_limit <= 0) {
-			dev_warn(dev->class_dev,
-				 "loop_limit reached in daqp_interrupt()\n");
-			s->async->events |= COMEDI_CB_ERROR;
-		}
+	comedi_handle_events(dev, s);
 
-		comedi_handle_events(dev, s);
-	}
 	return IRQ_HANDLED;
 }
 
@@ -570,8 +558,6 @@ static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
 		return -1;
 	}
 
-	devpriv->interrupt_mode = buffer;
-
 	/* Start conversion */
 	outb(DAQP_COMMAND_ARM | DAQP_COMMAND_FIFO_DATA | devpriv->scanrate,
 	     dev->iobase + DAQP_COMMAND);
-- 
2.5.1

_______________________________________________
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