staging: comedi: ni_tio_internal.h: replace NITIO_Gi_Mode_Reg()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Thu, 19 Dec 2013 23:31:37 +0000 (16:31 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Dec 2013 19:49:31 +0000 (11:49 -0800)
The "Mode" 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
drivers/staging/comedi/drivers/ni_tiocmd.c

index 38ad82333cdff3e549f042749365e6fa532e1876..5b46324e77debc288c119dbe5870eac7408a9f37 100644 (file)
@@ -380,7 +380,7 @@ void ni_tio_init_counter(struct ni_gpct *counter)
                       NITIO_AUTO_INC_REG(counter->counter_index));
        ni_tio_set_bits(counter, NITIO_CMD_REG(counter->counter_index),
                        ~0, Gi_Synchronize_Gate_Bit);
-       ni_tio_set_bits(counter, NITIO_Gi_Mode_Reg(counter->counter_index), ~0,
+       ni_tio_set_bits(counter, NITIO_MODE_REG(counter->counter_index), ~0,
                        0);
        counter_dev->regs[NITIO_Gi_LoadA_Reg(counter->counter_index)] = 0x0;
        write_register(counter,
@@ -502,7 +502,7 @@ static int ni_tio_set_counter_mode(struct ni_gpct *counter, unsigned mode)
        default:
                break;
        }
-       ni_tio_set_bits(counter, NITIO_Gi_Mode_Reg(counter->counter_index),
+       ni_tio_set_bits(counter, NITIO_MODE_REG(counter->counter_index),
                        mode_reg_mask, mode_reg_values);
 
        if (ni_tio_counting_mode_registers_present(counter_dev)) {
@@ -1030,7 +1030,7 @@ static void ni_tio_set_first_gate_modifiers(struct ni_gpct *counter,
                mode_values |= Gi_Rising_Edge_Gating_Bits;
        else
                mode_values |= Gi_Level_Gating_Bits;
-       ni_tio_set_bits(counter, NITIO_Gi_Mode_Reg(counter->counter_index),
+       ni_tio_set_bits(counter, NITIO_MODE_REG(counter->counter_index),
                        mode_mask, mode_values);
 }
 
@@ -1229,7 +1229,7 @@ int ni_tio_set_gate_src(struct ni_gpct *counter, unsigned gate_index,
        case 0:
                if (CR_CHAN(gate_source) == NI_GPCT_DISABLED_GATE_SELECT) {
                        ni_tio_set_bits(counter,
-                                       NITIO_Gi_Mode_Reg(counter->
+                                       NITIO_MODE_REG(counter->
                                                          counter_index),
                                        Gi_Gating_Mode_Mask,
                                        Gi_Gating_Disabled_Bits);
@@ -1491,7 +1491,7 @@ static int ni_tio_get_gate_src(struct ni_gpct *counter, unsigned gate_index,
 {
        struct ni_gpct_device *counter_dev = counter->counter_dev;
        const unsigned mode_bits = ni_tio_get_soft_copy(counter,
-                                                       NITIO_Gi_Mode_Reg
+                                                       NITIO_MODE_REG
                                                        (counter->
                                                         counter_index));
        const unsigned second_gate_reg =
index cda3875db0b8b79f2a0a6f09fd94c71ab6145786..1f7cc423b4574f11a031967b92f135a3462df62c 100644 (file)
@@ -24,6 +24,7 @@
 #define NITIO_AUTO_INC_REG(x)          (NITIO_G0_AUTO_INC + (x))
 #define NITIO_CMD_REG(x)               (NITIO_G0_CMD + (x))
 #define NITIO_SW_SAVE_REG(x)           (NITIO_G0_SW_SAVE + (x))
+#define NITIO_MODE_REG(x)              (NITIO_G0_MODE + (x))
 
 static inline enum ni_gpct_register NITIO_Gi_Counting_Mode_Reg(unsigned idx)
 {
@@ -137,21 +138,6 @@ static inline enum ni_gpct_register NITIO_Gi_LoadB_Reg(unsigned idx)
        return 0;
 }
 
-static inline enum ni_gpct_register NITIO_Gi_Mode_Reg(unsigned idx)
-{
-       switch (idx) {
-       case 0:
-               return NITIO_G0_MODE;
-       case 1:
-               return NITIO_G1_MODE;
-       case 2:
-               return NITIO_G2_MODE;
-       case 3:
-               return NITIO_G3_MODE;
-       }
-       return 0;
-}
-
 static inline enum ni_gpct_register NITIO_Gi_Second_Gate_Reg(unsigned idx)
 {
        switch (idx) {
index 4fb4df09dd3399fc5da84f71fb9c7c6375103163..b78103d6c5e1d4cb123b2a8d39cd5b9520a16c5c 100644 (file)
@@ -401,7 +401,7 @@ void ni_tio_acknowledge_and_confirm(struct ni_gpct *counter, int *gate_error,
                               (counter->counter_index));
        if (ni_tio_get_soft_copy
            (counter,
-            NITIO_Gi_Mode_Reg(counter->counter_index)) &
+            NITIO_MODE_REG(counter->counter_index)) &
            Gi_Loading_On_Gate_Bit) {
                if (gxx_status & Gi_Stale_Data_Bit(counter->counter_index)) {
                        if (stale_data)