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

staging: comedi: pcl816: remove 'int816_mode' from private data

This member of the private data is not needed.

Refactor the interrupt handler and the (*cancel) function to not use
the 'int816_mode' and remove the setting of this member in the (*do_cmd)
heler function.
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 10933a9c
...@@ -64,10 +64,6 @@ Configuration Options: ...@@ -64,10 +64,6 @@ Configuration Options:
/* R: high byte of A/D W: A/D range control */ /* R: high byte of A/D W: A/D range control */
#define PCL816_AD_HI 9 #define PCL816_AD_HI 9
/* type of interrupt handler */
#define INT_TYPE_AI1_DMA 2
#define INT_TYPE_AI3_DMA 5
#define MAGIC_DMA_WORD 0x5a5a #define MAGIC_DMA_WORD 0x5a5a
static const struct comedi_lrange range_pcl816 = { static const struct comedi_lrange range_pcl816 = {
...@@ -113,7 +109,6 @@ struct pcl816_private { ...@@ -113,7 +109,6 @@ struct pcl816_private {
int next_dma_buf; /* which DMA buffer will be used next round */ int next_dma_buf; /* which DMA buffer will be used next round */
long dma_runs_to_end; /* how many we must permorm DMA transfer to end of record */ long dma_runs_to_end; /* how many we must permorm DMA transfer to end of record */
unsigned long last_dma_run; /* how many bytes we must transfer on last DMA page */ unsigned long last_dma_run; /* how many bytes we must transfer on last DMA page */
int int816_mode; /* who now uses IRQ - 1=AI1 int, 2=AI1 dma, 3=AI3 int, 4AI3 dma */
int ai_act_scan; /* how many scans we finished */ int ai_act_scan; /* how many scans we finished */
unsigned int ai_act_chanlist[16]; /* MUX setting for actual AI operations */ unsigned int ai_act_chanlist[16]; /* MUX setting for actual AI operations */
unsigned int ai_poll_ptr; /* how many sampes transfer poll */ unsigned int ai_poll_ptr; /* how many sampes transfer poll */
...@@ -344,8 +339,7 @@ static irqreturn_t interrupt_pcl816(int irq, void *d) ...@@ -344,8 +339,7 @@ static irqreturn_t interrupt_pcl816(int irq, void *d)
struct comedi_device *dev = d; struct comedi_device *dev = d;
struct pcl816_private *devpriv = dev->private; struct pcl816_private *devpriv = dev->private;
if (!dev->attached || !devpriv->ai_cmd_running || if (!dev->attached || !devpriv->ai_cmd_running) {
!devpriv->int816_mode) {
outb(0, dev->iobase + PCL816_CLRINT); outb(0, dev->iobase + PCL816_CLRINT);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -356,14 +350,7 @@ static irqreturn_t interrupt_pcl816(int irq, void *d) ...@@ -356,14 +350,7 @@ static irqreturn_t interrupt_pcl816(int irq, void *d)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
switch (devpriv->int816_mode) { return interrupt_pcl816_ai_mode13_dma(irq, d);
case INT_TYPE_AI1_DMA:
case INT_TYPE_AI3_DMA:
return interrupt_pcl816_ai_mode13_dma(irq, d);
}
outb(0, dev->iobase + PCL816_CLRINT);
return IRQ_HANDLED;
} }
static int pcl816_ai_cmdtest(struct comedi_device *dev, static int pcl816_ai_cmdtest(struct comedi_device *dev,
...@@ -476,8 +463,6 @@ static int pcl816_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -476,8 +463,6 @@ static int pcl816_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
switch (cmd->convert_src) { switch (cmd->convert_src) {
case TRIG_TIMER: case TRIG_TIMER:
devpriv->int816_mode = INT_TYPE_AI1_DMA;
/* Pacer+IRQ+DMA */ /* Pacer+IRQ+DMA */
outb(0x32, dev->iobase + PCL816_CONTROL); outb(0x32, dev->iobase + PCL816_CONTROL);
...@@ -486,8 +471,6 @@ static int pcl816_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -486,8 +471,6 @@ static int pcl816_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
break; break;
default: default:
devpriv->int816_mode = INT_TYPE_AI3_DMA;
/* Ext trig+IRQ+DMA */ /* Ext trig+IRQ+DMA */
outb(0x34, dev->iobase + PCL816_CONTROL); outb(0x34, dev->iobase + PCL816_CONTROL);
...@@ -549,34 +532,28 @@ static int pcl816_ai_cancel(struct comedi_device *dev, ...@@ -549,34 +532,28 @@ static int pcl816_ai_cancel(struct comedi_device *dev,
if (!devpriv->ai_cmd_running) if (!devpriv->ai_cmd_running)
return 0; return 0;
switch (devpriv->int816_mode) { disable_dma(devpriv->dma);
case INT_TYPE_AI1_DMA: outb(inb(dev->iobase + PCL816_CONTROL) & 0x73,
case INT_TYPE_AI3_DMA: dev->iobase + PCL816_CONTROL); /* Stop A/D */
disable_dma(devpriv->dma); udelay(1);
outb(inb(dev->iobase + PCL816_CONTROL) & 0x73, outb(0, dev->iobase + PCL816_CONTROL); /* Stop A/D */
dev->iobase + PCL816_CONTROL); /* Stop A/D */
udelay(1);
outb(0, dev->iobase + PCL816_CONTROL); /* Stop A/D */
/* Stop pacer */
i8254_set_mode(dev->iobase + PCL816_TIMER_BASE, 0,
2, I8254_MODE0 | I8254_BINARY);
i8254_set_mode(dev->iobase + PCL816_TIMER_BASE, 0,
1, I8254_MODE0 | I8254_BINARY);
outb(0, dev->iobase + PCL816_AD_LO);
pcl816_ai_get_sample(dev, s);
/* clear INT request */
outb(0, dev->iobase + PCL816_CLRINT);
/* Stop A/D */ /* Stop pacer */
outb(0, dev->iobase + PCL816_CONTROL); i8254_set_mode(dev->iobase + PCL816_TIMER_BASE, 0,
devpriv->ai_cmd_running = 0; 2, I8254_MODE0 | I8254_BINARY);
devpriv->ai_cmd_canceled = 1; i8254_set_mode(dev->iobase + PCL816_TIMER_BASE, 0,
devpriv->int816_mode = 0; 1, I8254_MODE0 | I8254_BINARY);
break;
} outb(0, dev->iobase + PCL816_AD_LO);
pcl816_ai_get_sample(dev, s);
/* clear INT request */
outb(0, dev->iobase + PCL816_CLRINT);
/* Stop A/D */
outb(0, dev->iobase + PCL816_CONTROL);
devpriv->ai_cmd_running = 0;
devpriv->ai_cmd_canceled = 1;
return 0; return 0;
} }
......
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