Introduce a helper function to flush the fifo and clear the INT request. Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx> Cc: Ian Abbott <abbotti@xxxxxxxxx> Cc: Greg Kroah-Hartman <gregk@xxxxxxxxxxxxxxxxxxx> --- drivers/staging/comedi/drivers/adv_pci1710.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index f2a9c00..cb3edf9 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -429,6 +429,12 @@ static void pci171x_ai_setup_chanlist(struct comedi_device *dev, outw(devpriv->ai_et_MuxVal, dev->iobase + PCI171x_MUX); } +static void pci171x_ai_flush_fifo(struct comedi_device *dev) +{ + outb(0, dev->iobase + PCI171x_CLRFIFO); + outb(0, dev->iobase + PCI171x_CLRINT); +} + static int pci171x_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -454,8 +460,8 @@ static int pci171x_insn_read_ai(struct comedi_device *dev, devpriv->CntrlReg &= Control_CNT0; devpriv->CntrlReg |= Control_SW; /* set software trigger */ outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL); - outb(0, dev->iobase + PCI171x_CLRFIFO); - outb(0, dev->iobase + PCI171x_CLRINT); + + pci171x_ai_flush_fifo(dev); pci171x_ai_setup_chanlist(dev, s, &insn->chanspec, 1, 1); @@ -476,8 +482,7 @@ static int pci171x_insn_read_ai(struct comedi_device *dev, data[i] = val & s->maxdata; } - outb(0, dev->iobase + PCI171x_CLRFIFO); - outb(0, dev->iobase + PCI171x_CLRINT); + pci171x_ai_flush_fifo(dev); return ret ? ret : insn->n; } @@ -716,8 +721,7 @@ static int pci171x_ai_cancel(struct comedi_device *dev, outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL); /* reset any operations */ pci171x_start_pacer(dev, false); - outb(0, dev->iobase + PCI171x_CLRFIFO); - outb(0, dev->iobase + PCI171x_CLRINT); + pci171x_ai_flush_fifo(dev); break; } @@ -890,8 +894,7 @@ static irqreturn_t interrupt_service_pci1710(int irq, void *d) devpriv->CntrlReg |= Control_SW; /* set software trigger */ outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL); devpriv->CntrlReg = devpriv->ai_et_CntrlReg; - outb(0, dev->iobase + PCI171x_CLRFIFO); - outb(0, dev->iobase + PCI171x_CLRINT); + pci171x_ai_flush_fifo(dev); outw(devpriv->ai_et_MuxVal, dev->iobase + PCI171x_MUX); outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL); pci171x_start_pacer(dev, true); @@ -916,8 +919,7 @@ static int pci171x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) pci171x_ai_setup_chanlist(dev, s, cmd->chanlist, cmd->chanlist_len, devpriv->saved_seglen); - outb(0, dev->iobase + PCI171x_CLRFIFO); - outb(0, dev->iobase + PCI171x_CLRINT); + pci171x_ai_flush_fifo(dev); devpriv->ai_act_scan = 0; s->async->cur_chan = 0; @@ -1042,8 +1044,7 @@ static int pci171x_reset(struct comedi_device *dev) outw(0x30, dev->iobase + PCI171x_CNTCTRL); devpriv->CntrlReg = Control_SW | Control_CNT0; /* Software trigger, CNT0=external */ outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL); /* reset any operations */ - outb(0, dev->iobase + PCI171x_CLRFIFO); /* clear FIFO */ - outb(0, dev->iobase + PCI171x_CLRINT); /* clear INT request */ + pci171x_ai_flush_fifo(dev); pci171x_start_pacer(dev, false); devpriv->da_ranges = 0; if (this_board->n_aochan) { @@ -1056,8 +1057,7 @@ static int pci171x_reset(struct comedi_device *dev) } } outw(0, dev->iobase + PCI171x_DO); /* digital outputs to 0 */ - outb(0, dev->iobase + PCI171x_CLRFIFO); /* clear FIFO */ - outb(0, dev->iobase + PCI171x_CLRINT); /* clear INT request */ + pci171x_ai_flush_fifo(dev); return 0; } -- 1.9.3 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel