staging: comedi: adv_pci1710: absorb move_block_from_fifo()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 20 Jan 2015 21:53:26 +0000 (14:53 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Jan 2015 11:59:12 +0000 (19:59 +0800)
This function is only called by pci1710_handle_fifo(). Absorb it and clean up
pci1710_handle_fifo().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/adv_pci1710.c

index 76075dbf111047a52e69f2a4dbf694ab7f0175c7..9800c01e6fb97409966e1b35157656ff139f31ea 100644 (file)
@@ -696,55 +696,49 @@ static void pci1710_handle_every_sample(struct comedi_device *dev,
        outb(0, dev->iobase + PCI171x_CLRINT);  /*  clear our INT request */
 }
 
-static int move_block_from_fifo(struct comedi_device *dev,
-                               struct comedi_subdevice *s, int n)
-{
-       unsigned int val;
-       int ret;
-       int i;
-
-       for (i = 0; i < n; i++) {
-               ret = pci171x_ai_read_sample(dev, s, s->async->cur_chan, &val);
-               if (ret) {
-                       s->async->events |= COMEDI_CB_ERROR;
-                       return ret;
-               }
-
-               comedi_buf_write_samples(s, &val, 1);
-       }
-       return 0;
-}
-
 static void pci1710_handle_fifo(struct comedi_device *dev,
                                struct comedi_subdevice *s)
 {
        struct pci1710_private *devpriv = dev->private;
-       struct comedi_cmd *cmd = &s->async->cmd;
-       unsigned int m;
+       struct comedi_async *async = s->async;
+       struct comedi_cmd *cmd = &async->cmd;
+       unsigned int status;
+       int i;
 
-       m = inw(dev->iobase + PCI171x_STATUS);
-       if (!(m & Status_FH)) {
-               dev_dbg(dev->class_dev, "A/D FIFO not half full! (%4x)\n", m);
-               s->async->events |= COMEDI_CB_ERROR;
+       status = inw(dev->iobase + PCI171x_STATUS);
+       if (!(status & Status_FH)) {
+               dev_dbg(dev->class_dev, "A/D FIFO not half full!\n");
+               async->events |= COMEDI_CB_ERROR;
                return;
        }
-       if (m & Status_FF) {
+       if (status & Status_FF) {
                dev_dbg(dev->class_dev,
-                       "A/D FIFO Full status (Fatal Error!) (%4x)\n", m);
-               s->async->events |= COMEDI_CB_ERROR;
+                       "A/D FIFO Full status (Fatal Error!)\n");
+               async->events |= COMEDI_CB_ERROR;
                return;
        }
 
-       if (move_block_from_fifo(dev, s, devpriv->max_samples))
-               return;
+       for (i = 0; i < devpriv->max_samples; i++) {
+               unsigned int val;
+               int ret;
 
-       if (cmd->stop_src == TRIG_COUNT &&
-           s->async->scans_done >= cmd->stop_arg) {
-               s->async->events |= COMEDI_CB_EOA;
-               return;
+               ret = pci171x_ai_read_sample(dev, s, s->async->cur_chan, &val);
+               if (ret) {
+                       s->async->events |= COMEDI_CB_ERROR;
+                       break;
+               }
+
+               if (!comedi_buf_write_samples(s, &val, 1))
+                       break;
+
+               if (cmd->stop_src == TRIG_COUNT &&
+                   async->scans_done >= cmd->stop_arg) {
+                       async->events |= COMEDI_CB_EOA;
+                       break;
+               }
        }
-       outb(0, dev->iobase + PCI171x_CLRINT);  /*  clear our INT request */
 
+       outb(0, dev->iobase + PCI171x_CLRINT);  /*  clear our INT request */
 }
 
 static irqreturn_t interrupt_service_pci1710(int irq, void *d)