staging: comedi: ni_tio_internal.h: replace NITIO_Gxx_Joint_Reset_Reg()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Thu, 19 Dec 2013 23:31:44 +0000 (16:31 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Dec 2013 19:49:32 +0000 (11:49 -0800)
The shared "Reset" registers are sequential in the enum ni_gpct_register.
Replace this inline CamelCase function with a simple define.

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
drivers/staging/comedi/drivers/ni_tio_internal.h

index 7da8228f554ca4e659a7831c678c13f27e48279f..6fcaebd27de91835bc1483468ceca306e7b29d3b 100644 (file)
@@ -363,7 +363,7 @@ static int ni_tio_second_gate_registers_present(const struct ni_gpct_device
 static void ni_tio_reset_count_and_disarm(struct ni_gpct *counter)
 {
        write_register(counter, Gi_Reset_Bit(counter->counter_index),
-                      NITIO_Gxx_Joint_Reset_Reg(counter->counter_index));
+                      NITIO_RESET_REG(counter->counter_index));
 }
 
 void ni_tio_init_counter(struct ni_gpct *counter)
index 604fa6909f09d9c2dc136f74dacde5545bd823bf..f9eb2d0f6cb6b30f55f8db4b4f75f20469137df4 100644 (file)
 #define NITIO_CNT_MODE_REG(x)          (NITIO_G0_CNT_MODE + (x))
 #define NITIO_GATE2_REG(x)             (NITIO_G0_GATE2 + (x))
 #define NITIO_STATUS_REG(x)            (NITIO_G01_STATUS + ((x) / 2))
-
-static inline enum ni_gpct_register NITIO_Gxx_Joint_Reset_Reg(unsigned idx)
-{
-       switch (idx) {
-       case 0:
-       case 1:
-               return NITIO_G01_RESET;
-       case 2:
-       case 3:
-               return NITIO_G23_RESET;
-       }
-       return 0;
-}
+#define NITIO_RESET_REG(x)             (NITIO_G01_RESET + ((x) / 2))
 
 static inline enum ni_gpct_register NITIO_Gxx_Joint_Status1_Reg(unsigned idx)
 {