Commit f676376d authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: quatech_daqp_cs: remove 'interrupt_mode'

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: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7689f55b
...@@ -143,8 +143,6 @@ ...@@ -143,8 +143,6 @@
struct daqp_private { struct daqp_private {
int stop; int stop;
enum { semaphore, buffer } interrupt_mode;
}; };
static const struct comedi_lrange range_daqp_ai = { static const struct comedi_lrange range_daqp_ai = {
...@@ -187,8 +185,6 @@ static int daqp_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -187,8 +185,6 @@ static int daqp_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
/* flush any linguring data in FIFO - superfluous here */ /* flush any linguring data in FIFO - superfluous here */
/* outb(DAQP_CMD_RSTF, dev->iobase + DAQP_CMD_REG); */ /* outb(DAQP_CMD_RSTF, dev->iobase + DAQP_CMD_REG); */
devpriv->interrupt_mode = semaphore;
return 0; return 0;
} }
...@@ -206,10 +202,9 @@ static unsigned int daqp_ai_get_sample(struct comedi_device *dev, ...@@ -206,10 +202,9 @@ static unsigned int daqp_ai_get_sample(struct comedi_device *dev,
return comedi_offset_munge(s, val); return comedi_offset_munge(s, val);
} }
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 comedi_device *dev = dev_id;
struct daqp_private *devpriv = dev->private;
struct comedi_subdevice *s = dev->read_subdev; struct comedi_subdevice *s = dev->read_subdev;
struct comedi_cmd *cmd = &s->async->cmd; struct comedi_cmd *cmd = &s->async->cmd;
int loop_limit = 10000; int loop_limit = 10000;
...@@ -218,13 +213,8 @@ static enum irqreturn daqp_interrupt(int irq, void *dev_id) ...@@ -218,13 +213,8 @@ static enum irqreturn daqp_interrupt(int irq, void *dev_id)
if (!dev->attached) if (!dev->attached)
return IRQ_NONE; return IRQ_NONE;
switch (devpriv->interrupt_mode) { status = inb(dev->iobase + DAQP_STATUS_REG);
case semaphore: while (!(status & DAQP_STATUS_FIFO_EMPTY)) {
break;
case buffer:
while (!((status = inb(dev->iobase + DAQP_STATUS_REG))
& DAQP_STATUS_FIFO_EMPTY)) {
unsigned short data; unsigned short data;
if (status & DAQP_STATUS_DATA_LOST) { if (status & DAQP_STATUS_DATA_LOST) {
...@@ -236,10 +226,6 @@ static enum irqreturn daqp_interrupt(int irq, void *dev_id) ...@@ -236,10 +226,6 @@ static enum irqreturn daqp_interrupt(int irq, void *dev_id)
data = daqp_ai_get_sample(dev, s); data = daqp_ai_get_sample(dev, s);
comedi_buf_write_samples(s, &data, 1); comedi_buf_write_samples(s, &data, 1);
/* If there's a limit, decrement it
* and stop conversion if zero
*/
if (cmd->stop_src == TRIG_COUNT && if (cmd->stop_src == TRIG_COUNT &&
s->async->scans_done >= cmd->stop_arg) { s->async->scans_done >= cmd->stop_arg) {
s->async->events |= COMEDI_CB_EOA; s->async->events |= COMEDI_CB_EOA;
...@@ -248,6 +234,8 @@ static enum irqreturn daqp_interrupt(int irq, void *dev_id) ...@@ -248,6 +234,8 @@ static enum irqreturn daqp_interrupt(int irq, void *dev_id)
if ((loop_limit--) <= 0) if ((loop_limit--) <= 0)
break; break;
status = inb(dev->iobase + DAQP_STATUS_REG);
} }
if (loop_limit <= 0) { if (loop_limit <= 0) {
...@@ -257,7 +245,7 @@ static enum irqreturn daqp_interrupt(int irq, void *dev_id) ...@@ -257,7 +245,7 @@ static enum irqreturn daqp_interrupt(int irq, void *dev_id)
} }
comedi_handle_events(dev, s); comedi_handle_events(dev, s);
}
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -624,8 +612,6 @@ static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -624,8 +612,6 @@ static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
if (ret) if (ret)
return ret; return ret;
devpriv->interrupt_mode = buffer;
/* Start conversion */ /* Start conversion */
outb(DAQP_CMD_ARM | DAQP_CMD_FIFO_DATA, dev->iobase + DAQP_CMD_REG); outb(DAQP_CMD_ARM | DAQP_CMD_FIFO_DATA, dev->iobase + DAQP_CMD_REG);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment