staging: comedi: adl_pc19111: remove 'stop_is_none' from private data
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 5 May 2014 16:48:17 +0000 (09:48 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 May 2014 12:21:30 +0000 (21:21 +0900)
This member of the private data can be determined by checking the
cmd->stop_src. Do that instead.

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/adl_pci9111.c

index 96b1bf8..430b51a 100644 (file)
@@ -137,7 +137,6 @@ struct pci9111_private_data {
        unsigned long lcr_io_base;
 
        int stop_counter;
-       int stop_is_none;
 
        unsigned int scan_delay;
        unsigned int chanlist_len;
@@ -485,10 +484,8 @@ static int pci9111_ai_do_cmd(struct comedi_device *dev,
        if (async_cmd->stop_src == TRIG_COUNT) {
                dev_private->stop_counter =
                    async_cmd->stop_arg * async_cmd->chanlist_len;
-               dev_private->stop_is_none = 0;
        } else {        /* TRIG_NONE */
                dev_private->stop_counter = 0;
-               dev_private->stop_is_none = 1;
        }
 
        /*  Set timer pacer */
@@ -550,6 +547,7 @@ static irqreturn_t pci9111_interrupt(int irq, void *p_device)
        struct pci9111_private_data *dev_private = dev->private;
        struct comedi_subdevice *s = dev->read_subdev;
        struct comedi_async *async;
+       struct comedi_cmd *cmd;
        unsigned int status;
        unsigned long irq_flags;
        unsigned char intcsr;
@@ -561,6 +559,7 @@ static irqreturn_t pci9111_interrupt(int irq, void *p_device)
        }
 
        async = s->async;
+       cmd = &async->cmd;
 
        spin_lock_irqsave(&dev->spinlock, irq_flags);
 
@@ -596,12 +595,11 @@ static irqreturn_t pci9111_interrupt(int irq, void *p_device)
                        unsigned int num_samples;
                        unsigned int bytes_written = 0;
 
-                       num_samples =
-                           PCI9111_FIFO_HALF_SIZE >
-                           dev_private->stop_counter
-                           && !dev_private->
-                           stop_is_none ? dev_private->stop_counter :
-                           PCI9111_FIFO_HALF_SIZE;
+                       if (cmd->stop_src == TRIG_COUNT &&
+                           PCI9111_FIFO_HALF_SIZE > dev_private->stop_counter)
+                               num_samples = dev_private->stop_counter;
+                       else
+                               num_samples = PCI9111_FIFO_HALF_SIZE;
                        insw(dev->iobase + PCI9111_AI_FIFO_REG,
                             dev_private->ai_bounce_buffer, num_samples);
 
@@ -664,7 +662,7 @@ static irqreturn_t pci9111_interrupt(int irq, void *p_device)
                }
        }
 
-       if (dev_private->stop_counter == 0 && !dev_private->stop_is_none)
+       if (cmd->stop_src == TRIG_COUNT && dev_private->stop_counter == 0)
                async->events |= COMEDI_CB_EOA;
 
        outb(0, dev->iobase + PCI9111_INT_CLR_REG);