summaryrefslogtreecommitdiff
path: root/drivers/staging/comedi/drivers/ni_tio.c
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2014-07-28 10:26:46 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-07-30 16:50:59 -0700
commit56bd1ac7089872e9f282a83ed73d8e8dba48f0b2 (patch)
tree4765469178530211d14e04dd9f01fdb051f069ea /drivers/staging/comedi/drivers/ni_tio.c
parentf57f5848f9b313889702b018220ea256284dbddf (diff)
staging: comedi: ni_tio: tidy up ni_tio_read_sw_save_reg()
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>
Diffstat (limited to 'drivers/staging/comedi/drivers/ni_tio.c')
-rw-r--r--drivers/staging/comedi/drivers/ni_tio.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/staging/comedi/drivers/ni_tio.c b/drivers/staging/comedi/drivers/ni_tio.c
index f9f632014511..6ed14dfa142a 100644
--- a/drivers/staging/comedi/drivers/ni_tio.c
+++ b/drivers/staging/comedi/drivers/ni_tio.c
@@ -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,