From: H Hartley Sweeten Date: Thu, 19 Dec 2013 23:31:37 +0000 (-0700) Subject: staging: comedi: ni_tio_internal.h: replace NITIO_Gi_Mode_Reg() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0101791e83cbd9076c34bf138d1407442dfdf95f;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/ni_tio.c b/drivers/staging/comedi/drivers/ni_tio.c index 38ad82333cdf..5b46324e77de 100644 --- a/drivers/staging/comedi/drivers/ni_tio.c +++ b/drivers/staging/comedi/drivers/ni_tio.c @@ -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 = diff --git a/drivers/staging/comedi/drivers/ni_tio_internal.h b/drivers/staging/comedi/drivers/ni_tio_internal.h index cda3875db0b8..1f7cc423b457 100644 --- a/drivers/staging/comedi/drivers/ni_tio_internal.h +++ b/drivers/staging/comedi/drivers/ni_tio_internal.h @@ -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) { diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c b/drivers/staging/comedi/drivers/ni_tiocmd.c index 4fb4df09dd33..b78103d6c5e1 100644 --- a/drivers/staging/comedi/drivers/ni_tiocmd.c +++ b/drivers/staging/comedi/drivers/ni_tiocmd.c @@ -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)