staging: comedi: ni_tio_internal.h: replace NITIO_Gi_LoadA_Reg()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Thu, 19 Dec 2013 23:31:38 +0000 (16:31 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Dec 2013 19:49:31 +0000 (11:49 -0800)
The "LoadA" 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 5b46324e77debc288c119dbe5870eac7408a9f37..f203a6c07f8625a185852f8b3d3372cd5682d8e4 100644 (file)
@@ -382,11 +382,11 @@ void ni_tio_init_counter(struct ni_gpct *counter)
                        ~0, Gi_Synchronize_Gate_Bit);
        ni_tio_set_bits(counter, NITIO_MODE_REG(counter->counter_index), ~0,
                        0);
-       counter_dev->regs[NITIO_Gi_LoadA_Reg(counter->counter_index)] = 0x0;
+       counter_dev->regs[NITIO_LOADA_REG(counter->counter_index)] = 0x0;
        write_register(counter,
                       counter_dev->
-                      regs[NITIO_Gi_LoadA_Reg(counter->counter_index)],
-                      NITIO_Gi_LoadA_Reg(counter->counter_index));
+                      regs[NITIO_LOADA_REG(counter->counter_index)],
+                      NITIO_LOADA_REG(counter->counter_index));
        counter_dev->regs[NITIO_Gi_LoadB_Reg(counter->counter_index)] = 0x0;
        write_register(counter,
                       counter_dev->
@@ -1664,7 +1664,7 @@ int ni_tio_rinsn(struct ni_gpct *counter, struct comedi_insn *insn,
        case 1:
                data[0] =
                    counter_dev->
-                   regs[NITIO_Gi_LoadA_Reg(counter->counter_index)];
+                   regs[NITIO_LOADA_REG(counter->counter_index)];
                break;
        case 2:
                data[0] =
@@ -1685,7 +1685,7 @@ static unsigned ni_tio_next_load_register(struct ni_gpct *counter)
        if (bits & Gi_Next_Load_Source_Bit(counter->counter_index))
                return NITIO_Gi_LoadB_Reg(counter->counter_index);
        else
-               return NITIO_Gi_LoadA_Reg(counter->counter_index);
+               return NITIO_LOADA_REG(counter->counter_index);
 }
 
 int ni_tio_winsn(struct ni_gpct *counter, struct comedi_insn *insn,
@@ -1710,10 +1710,10 @@ int ni_tio_winsn(struct ni_gpct *counter, struct comedi_insn *insn,
                write_register(counter, counter_dev->regs[load_reg], load_reg);
                break;
        case 1:
-               counter_dev->regs[NITIO_Gi_LoadA_Reg(counter->counter_index)] =
+               counter_dev->regs[NITIO_LOADA_REG(counter->counter_index)] =
                    data[0];
                write_register(counter, data[0],
-                              NITIO_Gi_LoadA_Reg(counter->counter_index));
+                              NITIO_LOADA_REG(counter->counter_index));
                break;
        case 2:
                counter_dev->regs[NITIO_Gi_LoadB_Reg(counter->counter_index)] =
index 1f7cc423b4574f11a031967b92f135a3462df62c..1df787054bf91e042e879ba175fdb63adef4afe9 100644 (file)
@@ -25,6 +25,7 @@
 #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))
+#define NITIO_LOADA_REG(x)             (NITIO_G0_LOADA + (x))
 
 static inline enum ni_gpct_register NITIO_Gi_Counting_Mode_Reg(unsigned idx)
 {
@@ -108,21 +109,6 @@ static inline enum ni_gpct_register NITIO_Gxx_Status_Reg(unsigned idx)
        return 0;
 }
 
-static inline enum ni_gpct_register NITIO_Gi_LoadA_Reg(unsigned idx)
-{
-       switch (idx) {
-       case 0:
-               return NITIO_G0_LOADA;
-       case 1:
-               return NITIO_G1_LOADA;
-       case 2:
-               return NITIO_G2_LOADA;
-       case 3:
-               return NITIO_G3_LOADA;
-       }
-       return 0;
-}
-
 static inline enum ni_gpct_register NITIO_Gi_LoadB_Reg(unsigned idx)
 {
        switch (idx) {