Commit 0101791e authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: ni_tio_internal.h: replace NITIO_Gi_Mode_Reg()

The "Mode" registers are sequential in the enum ni_gpct_register.
Replace this inline CamelCase function with a simple define.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 67c68de0
......@@ -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 =
......
......@@ -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) {
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment