staging: comedi: ni_tio: tidy up ni_tio_read_sw_save_reg()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 28 Jul 2014 17:26:46 +0000 (10:26 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Jul 2014 23:50:59 +0000 (16:50 -0700)
Remove the need for some of the local variables.

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

index f9f632014511ba680f4380527260b0661ce0ec27..6ed14dfa142a4ade718225f03bf7f552e05b4a06 100644 (file)
@@ -1266,9 +1266,7 @@ static unsigned int ni_tio_read_sw_save_reg(struct comedi_device *dev,
 {
        struct ni_gpct *counter = s->private;
        unsigned cidx = counter->counter_index;
-       unsigned int first_read;
-       unsigned int second_read;
-       unsigned int correct_read;
+       unsigned int val;
 
        ni_tio_set_bits(counter, NITIO_CMD_REG(cidx), Gi_Save_Trace_Bit, 0);
        ni_tio_set_bits(counter, NITIO_CMD_REG(cidx),
@@ -1283,14 +1281,11 @@ static unsigned int ni_tio_read_sw_save_reg(struct comedi_device *dev,
         * will be correct since the count value will definitely have latched
         * by then.
         */
-       first_read = read_register(counter, NITIO_SW_SAVE_REG(cidx));
-       second_read = read_register(counter, NITIO_SW_SAVE_REG(cidx));
-       if (first_read != second_read)
-               correct_read = read_register(counter, NITIO_SW_SAVE_REG(cidx));
-       else
-               correct_read = first_read;
-
-       return correct_read;
+       val = read_register(counter, NITIO_SW_SAVE_REG(cidx));
+       if (val != read_register(counter, NITIO_SW_SAVE_REG(cidx)))
+               val = read_register(counter, NITIO_SW_SAVE_REG(cidx));
+
+       return val;
 }
 
 int ni_tio_insn_read(struct comedi_device *dev,