From 613117fbfe02586f4f53b83b668eab06bec6bc5f Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 28 Jul 2014 10:27:00 -0700 Subject: [PATCH] staging: comedi: ni_tio: tidy up G{02, 12}_Interrupt_Enable_Bits Convert these enums into defines and rename the CamelCase symbols. For aesthetics, move the new defines so they are associated with the register define. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- .../staging/comedi/drivers/ni_tio_internal.h | 21 ++----------------- drivers/staging/comedi/drivers/ni_tiocmd.c | 6 +++--- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_tio_internal.h b/drivers/staging/comedi/drivers/ni_tio_internal.h index 37cdb4960803..2bceae493e23 100644 --- a/drivers/staging/comedi/drivers/ni_tio_internal.h +++ b/drivers/staging/comedi/drivers/ni_tio_internal.h @@ -153,25 +153,8 @@ #define GI_TC (1 << 3) #define GI_INTERRUPT (1 << 15) #define NITIO_INT_ENA_REG(x) (NITIO_G0_INT_ENA + (x)) - -enum G02_Interrupt_Enable_Bits { - G0_TC_Interrupt_Enable_Bit = 0x40, - G0_Gate_Interrupt_Enable_Bit = 0x100 -}; -enum G13_Interrupt_Enable_Bits { - G1_TC_Interrupt_Enable_Bit = 0x200, - G1_Gate_Interrupt_Enable_Bit = 0x400 -}; -static inline unsigned Gi_Gate_Interrupt_Enable_Bit(unsigned counter_index) -{ - unsigned bit; - - if (counter_index % 2) - bit = G1_Gate_Interrupt_Enable_Bit; - else - bit = G0_Gate_Interrupt_Enable_Bit; - return bit; -} +#define GI_TC_INTERRUPT_ENABLE(x) (((x) % 2) ? (1 << 9) : (1 << 6)) +#define GI_GATE_INTERRUPT_ENABLE(x) (((x) % 2) ? (1 << 10) : (1 << 8)) static inline void write_register(struct ni_gpct *counter, unsigned bits, enum ni_gpct_register reg) diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c b/drivers/staging/comedi/drivers/ni_tiocmd.c index 3ec8995f0cf4..8c89786047e1 100644 --- a/drivers/staging/comedi/drivers/ni_tiocmd.c +++ b/drivers/staging/comedi/drivers/ni_tiocmd.c @@ -201,8 +201,8 @@ static int ni_tio_cmd_setup(struct comedi_subdevice *s) retval = ni_tio_set_gate_src(counter, 0, gate_source); if (cmd->flags & TRIG_WAKE_EOS) { ni_tio_set_bits(counter, NITIO_INT_ENA_REG(cidx), - Gi_Gate_Interrupt_Enable_Bit(cidx), - Gi_Gate_Interrupt_Enable_Bit(cidx)); + GI_GATE_INTERRUPT_ENABLE(cidx), + GI_GATE_INTERRUPT_ENABLE(cidx)); } return retval; } @@ -322,7 +322,7 @@ int ni_tio_cancel(struct ni_gpct *counter) ni_tio_configure_dma(counter, 0, 0); ni_tio_set_bits(counter, NITIO_INT_ENA_REG(cidx), - Gi_Gate_Interrupt_Enable_Bit(cidx), 0x0); + GI_GATE_INTERRUPT_ENABLE(cidx), 0x0); return 0; } EXPORT_SYMBOL_GPL(ni_tio_cancel); -- 2.39.5