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 <hswee...@visionengravers.com>
Cc: Ian Abbott <abbo...@mev.co.uk>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
---
 drivers/staging/comedi/drivers/ni_tio_internal.h | 19 +++----------------
 drivers/staging/comedi/drivers/ni_tiocmd.c       |  2 +-
 2 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_tio_internal.h 
b/drivers/staging/comedi/drivers/ni_tio_internal.h
index ea1c9fb..18a1e16 100644
--- a/drivers/staging/comedi/drivers/ni_tio_internal.h
+++ b/drivers/staging/comedi/drivers/ni_tio_internal.h
@@ -129,6 +129,9 @@
 #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))
@@ -136,22 +139,6 @@
 #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,
diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c 
b/drivers/staging/comedi/drivers/ni_tiocmd.c
index d628748..9ba4079 100644
--- a/drivers/staging/comedi/drivers/ni_tiocmd.c
+++ b/drivers/staging/comedi/drivers/ni_tiocmd.c
@@ -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__);
-- 
2.0.3

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to