staging: comedi: ni_tio: tidy up Gxx_Joint_Status2_Bits
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 28 Jul 2014 17:26:55 +0000 (10:26 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Jul 2014 23:51:00 +0000 (16:51 -0700)
Convert this enum 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 ea1c9fb269af1065af89d1dbb753a69fbdbd52a3..18a1e16ba0a529a444c1e96303092e4c2d610e97 100644 (file)
 #define GI_RESET(x)                    (1 << (2 + ((x) % 2)))
 #define NITIO_STATUS1_REG(x)           (NITIO_G01_STATUS1 + ((x) / 2))
 #define NITIO_STATUS2_REG(x)           (NITIO_G01_STATUS2 + ((x) / 2))
+#define GI_OUTPUT(x)                   (((x) % 2) ? (1 << 1) : (1 << 0))
+#define GI_HW_SAVE(x)                  (((x) % 2) ? (1 << 13) : (1 << 12))
+#define GI_PERMANENT_STALE(x)          (((x) % 2) ? (1 << 15) : (1 << 14))
 #define NITIO_DMA_CFG_REG(x)           (NITIO_G0_DMA_CFG + (x))
 #define NITIO_DMA_STATUS_REG(x)                (NITIO_G0_DMA_STATUS + (x))
 #define NITIO_ABZ_REG(x)               (NITIO_G0_ABZ + (x))
 #define NITIO_STATUS_REG(x)            (NITIO_G0_STATUS + (x))
 #define NITIO_INT_ENA_REG(x)           (NITIO_G0_INT_ENA + (x))
 
-enum Gxx_Joint_Status2_Bits {
-       G0_Output_Bit = 0x1,
-       G1_Output_Bit = 0x2,
-       G0_HW_Save_Bit = 0x1000,
-       G1_HW_Save_Bit = 0x2000,
-       G0_Permanent_Stale_Bit = 0x4000,
-       G1_Permanent_Stale_Bit = 0x8000
-};
-static inline enum Gxx_Joint_Status2_Bits Gi_Permanent_Stale_Bit(unsigned
-                                                                counter_index)
-{
-       if (counter_index % 2)
-               return G1_Permanent_Stale_Bit;
-       return G0_Permanent_Stale_Bit;
-}
-
 enum Gi_DMA_Config_Reg_Bits {
        Gi_DMA_Enable_Bit = 0x1,
        Gi_DMA_Write_Bit = 0x2,
index d628748ac5139a919b81ee7a846a7add898d42c8..9ba40794ac211830f2978e00cc0ce2adbca03832 100644 (file)
@@ -409,7 +409,7 @@ void ni_tio_acknowledge_and_confirm(struct ni_gpct *counter, int *gate_error,
                                *stale_data = 1;
                }
                if (read_register(counter, NITIO_STATUS2_REG(cidx)) &
-                   Gi_Permanent_Stale_Bit(cidx)) {
+                   GI_PERMANENT_STALE(cidx)) {
                        dev_info(counter->counter_dev->dev->class_dev,
                                 "%s: Gi_Permanent_Stale_Data detected.\n",
                                 __func__);
This page took 0.02648 seconds and 5 git commands to generate.