From d3fed0813242a2fa6604e627326724d7cae9a068 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 1 May 2015 14:59:46 -0700 Subject: [PATCH] staging: comedi: ni_stc.h: tidy up Joint_Status_1_Register Rename the CamelCase. Use the BIT() macro to define the bits. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_mio_common.c | 18 ++++++++++-------- drivers/staging/comedi/drivers/ni_stc.h | 6 +++--- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index b194d1558463..9051477f7ac6 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -423,7 +423,7 @@ static const struct mio_regmap m_series_stc_read_regmap[] = { [NISTC_AO_UI_SAVE_REG] = { 0x120, 4 }, [NISTC_AO_BC_SAVE_REG] = { 0x124, 4 }, [NISTC_AO_UC_SAVE_REG] = { 0x128, 4 }, - [Joint_Status_1_Register] = { 0x136, 2 }, + [NISTC_STATUS1_REG] = { 0x136, 2 }, [DIO_Serial_Input_Register] = { 0x009, 1 }, [Joint_Status_2_Register] = { 0x13a, 2 }, [AI_SI_Save_Registers] = { 0x180, 4 }, @@ -3522,8 +3522,8 @@ static int ni_serial_hw_readwrite8(struct comedi_device *dev, devpriv->dio_output |= NISTC_DIO_OUT_SERIAL(data_out); ni_stc_writew(dev, devpriv->dio_output, NISTC_DIO_OUT_REG); - status1 = ni_stc_readw(dev, Joint_Status_1_Register); - if (status1 & DIO_Serial_IO_In_Progress_St) { + status1 = ni_stc_readw(dev, NISTC_STATUS1_REG); + if (status1 & NISTC_STATUS1_SERIO_IN_PROG) { err = -EBUSY; goto Error; } @@ -3533,8 +3533,8 @@ static int ni_serial_hw_readwrite8(struct comedi_device *dev, devpriv->dio_control &= ~NISTC_DIO_CTRL_HW_SER_START; /* Wait until STC says we're done, but don't loop infinitely. */ - while ((status1 = ni_stc_readw(dev, Joint_Status_1_Register)) & - DIO_Serial_IO_In_Progress_St) { + while ((status1 = ni_stc_readw(dev, NISTC_STATUS1_REG)) & + NISTC_STATUS1_SERIO_IN_PROG) { /* Delay one bit per loop */ udelay((devpriv->serial_interval_ns + 999) / 1000); if (--count < 0) { @@ -3545,8 +3545,10 @@ static int ni_serial_hw_readwrite8(struct comedi_device *dev, } } - /* Delay for last bit. This delay is absolutely necessary, because - DIO_Serial_IO_In_Progress_St goes high one bit too early. */ + /* + * Delay for last bit. This delay is absolutely necessary, because + * NISTC_STATUS1_SERIO_IN_PROG goes high one bit too early. + */ udelay((devpriv->serial_interval_ns + 999) / 1000); if (data_in) @@ -3724,7 +3726,7 @@ static const struct mio_regmap ni_gpct_to_stc_regmap[] = { [NITIO_G1_GATE2] = { 0x1b6, 2 }, /* M-Series only */ [NITIO_G01_STATUS] = { NISTC_G01_STATUS_REG, 2 }, [NITIO_G01_RESET] = { NISTC_RESET_REG, 2 }, - [NITIO_G01_STATUS1] = { Joint_Status_1_Register, 2 }, + [NITIO_G01_STATUS1] = { NISTC_STATUS1_REG, 2 }, [NITIO_G01_STATUS2] = { Joint_Status_2_Register, 2 }, [NITIO_G0_DMA_CFG] = { 0x1b8, 2 }, /* M-Series only */ [NITIO_G1_DMA_CFG] = { 0x1ba, 2 }, /* M-Series only */ diff --git a/drivers/staging/comedi/drivers/ni_stc.h b/drivers/staging/comedi/drivers/ni_stc.h index af07e4c7f698..2d7f342790fa 100644 --- a/drivers/staging/comedi/drivers/ni_stc.h +++ b/drivers/staging/comedi/drivers/ni_stc.h @@ -550,12 +550,12 @@ #define NISTC_AO_BC_SAVE_REG 18 #define NISTC_AO_UC_SAVE_REG 20 +#define NISTC_STATUS1_REG 27 +#define NISTC_STATUS1_SERIO_IN_PROG BIT(12) + #define AI_SI_Save_Registers 64 #define AI_SC_Save_Registers 66 -#define Joint_Status_1_Register 27 -#define DIO_Serial_IO_In_Progress_St _bit12 - #define DIO_Serial_Input_Register 28 #define Joint_Status_2_Register 29 enum Joint_Status_2_Bits { -- 2.39.5