staging: comedi: ni_tio: tidy up G{02, 12}_Interrupt_Enable_Bits
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 28 Jul 2014 17:27:00 +0000 (10:27 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Jul 2014 23:51:00 +0000 (16:51 -0700)
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 <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_internal.h
drivers/staging/comedi/drivers/ni_tiocmd.c

index 37cdb4960803444fb9fddebed2c46b9273777e16..2bceae493e23f76a9b26a08d5c679b8ce0ad75b2 100644 (file)
 #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)
index 3ec8995f0cf429df05c9daac9e511866954aeb4f..8c89786047e10900afed0951f10ae0b4de3e0fd3 100644 (file)
@@ -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);
This page took 0.026086 seconds and 5 git commands to generate.