staging: comedi: ni_tio: tidy up Gxx_Interrupt_Acknowledge_Bits
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 28 Jul 2014 17:26:58 +0000 (10:26 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Jul 2014 23:51:00 +0000 (16:51 -0700)
Convert this enum and the others related to it 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 db6b56307db9a67df5d30e036880dda97bfbe5c6..8d1b254c37aab6c21c9016a800f6f425fb0fa749 100644 (file)
 #define GI_DRQ_STATUS                  (1 << 15)
 #define NITIO_ABZ_REG(x)               (NITIO_G0_ABZ + (x))
 #define NITIO_INT_ACK_REG(x)           (NITIO_G0_INT_ACK + (x))
+#define GI_GATE_ERROR_CONFIRM(x)       (((x) % 2) ? (1 << 1) : (1 << 5))
+#define GI_TC_ERROR_CONFIRM(x)         (((x) % 2) ? (1 << 2) : (1 << 6))
+#define GI_TC_INTERRUPT_ACK            (1 << 14)
+#define GI_GATE_INTERRUPT_ACK          (1 << 15)
 #define NITIO_STATUS_REG(x)            (NITIO_G0_STATUS + (x))
 #define NITIO_INT_ENA_REG(x)           (NITIO_G0_INT_ENA + (x))
 
-enum G02_Interrupt_Acknowledge_Bits {
-       G0_Gate_Error_Confirm_Bit = 0x20,
-       G0_TC_Error_Confirm_Bit = 0x40
-};
-enum G13_Interrupt_Acknowledge_Bits {
-       G1_Gate_Error_Confirm_Bit = 0x2,
-       G1_TC_Error_Confirm_Bit = 0x4
-};
-static inline unsigned Gi_Gate_Error_Confirm_Bit(unsigned counter_index)
-{
-       if (counter_index % 2)
-               return G1_Gate_Error_Confirm_Bit;
-       return G0_Gate_Error_Confirm_Bit;
-}
-
-static inline unsigned Gi_TC_Error_Confirm_Bit(unsigned counter_index)
-{
-       if (counter_index % 2)
-               return G1_TC_Error_Confirm_Bit;
-       return G0_TC_Error_Confirm_Bit;
-}
-
-/* bits that are the same in G0/G2 and G1/G3 interrupt acknowledge registers */
-enum Gxx_Interrupt_Acknowledge_Bits {
-       Gi_TC_Interrupt_Ack_Bit = 0x4000,
-       Gi_Gate_Interrupt_Ack_Bit = 0x8000
-};
-
 enum Gi_Status_Bits {
        Gi_Gate_Interrupt_Bit = 0x4,
        Gi_TC_Bit = 0x8,
index f8019bf57ea5f0edf9e38c878bde8a7104244380..43a7bee55052e44bf4e265e095508b6330c658c2 100644 (file)
@@ -378,7 +378,7 @@ void ni_tio_acknowledge_and_confirm(struct ni_gpct *counter, int *gate_error,
                *stale_data = 0;
 
        if (gxx_status & GI_GATE_ERROR(cidx)) {
-               ack |= Gi_Gate_Error_Confirm_Bit(cidx);
+               ack |= GI_GATE_ERROR_CONFIRM(cidx);
                if (gate_error) {
                        /*660x don't support automatic acknowledgement
                          of gate interrupt via dma read/write
@@ -390,15 +390,15 @@ void ni_tio_acknowledge_and_confirm(struct ni_gpct *counter, int *gate_error,
                }
        }
        if (gxx_status & GI_TC_ERROR(cidx)) {
-               ack |= Gi_TC_Error_Confirm_Bit(cidx);
+               ack |= GI_TC_ERROR_CONFIRM(cidx);
                if (tc_error)
                        *tc_error = 1;
        }
        if (gi_status & Gi_TC_Bit)
-               ack |= Gi_TC_Interrupt_Ack_Bit;
+               ack |= GI_TC_INTERRUPT_ACK;
        if (gi_status & Gi_Gate_Interrupt_Bit) {
                if (should_ack_gate(counter))
-                       ack |= Gi_Gate_Interrupt_Ack_Bit;
+                       ack |= GI_GATE_INTERRUPT_ACK;
        }
        if (ack)
                write_register(counter, ack, NITIO_INT_ACK_REG(cidx));
This page took 0.027594 seconds and 5 git commands to generate.