From: H Hartley Sweeten Date: Mon, 28 Jul 2014 17:26:55 +0000 (-0700) Subject: staging: comedi: ni_tio: tidy up Gxx_Joint_Status2_Bits X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=29c2003d11a57c88d99e892e9dd26b36d29ae454;p=deliverable%2Flinux.git staging: comedi: ni_tio: tidy up Gxx_Joint_Status2_Bits 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 Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/ni_tio_internal.h b/drivers/staging/comedi/drivers/ni_tio_internal.h index ea1c9fb269af..18a1e16ba0a5 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 d628748ac513..9ba40794ac21 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__);