From 56bd1ac7089872e9f282a83ed73d8e8dba48f0b2 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 28 Jul 2014 10:26:46 -0700 Subject: [PATCH] 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 Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_tio.c | 17 ++++++----------- 1 file 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, -- 2.30.2