[PATCH 000/107] staging: comedi: tidy up ni_stc.h

Ian Abbott abbotti at mev.co.uk
Tue May 5 15:57:50 UTC 2015


On 01/05/15 22:58, H Hartley Sweeten wrote:
> The ni_stc.h header contains the DAQ-STC and board specific register
> information used by ni_mio_common.c to provide the "guts" for the
> National Instruments MIO drivers ni_atmio, ni_mio_cs, and ni_pcimio.
> Those drivers all currently include the ni_mio_common.c file.
>
> This header is a bit of a mess...
>
>    1) almost everything is CamelCase
>    2) bits are described as
>       a) #defines with custom _bit defines instead of the BIT() macro
>       b) raw values or bit shifts
>       b) enums with either custom _bit defines, raw values, or bit shifts
>       c) inline functions
>    3) there is quite a bit of unused information that is duplicated in the
>       ni_tio_internal.h header
>
> This series addresses these issues and gets the ni_stc.h file into a
> consistent, easier maintainable, format.
>
> It also refactors the STC register remapping for the M-Series boards and
> the ni_tio GPCT (general purpose counter timer) to STC.
>
> In addition a number of unreachable, or unnecessary, BUG() and BUG_ON() checks
> are removed.
>
> H Hartley Sweeten (107):
>    staging: comedi: ni_mio_common: refactor m-series stc register handling
>    staging: comedi: ni_mio_common: open code the M-Series regmap offsets
>    staging: comedi: ni_mio_common: refactor gpct to stc register handling
>    staging: comedi: ni_mio_common: open code the M-Series GPCT register offsets
>    staging: comedi: ni_mio_common: simplify ni_m_series_set_pfi_routing()
>    staging: comedi: ni_stc.h: tidy up M_Offset_* values
>    staging: comedi: ni_stc.h: reg_type is not needed by MSeries_AI_Config_Bank_Bits()
>    staging: comedi: ni_stc.h: simplify MSeries_AI_Config_Bank_Bits()
>    staging: comedi: ni_stc.h: rename M_Offset_* symbols
>    staging: comedi: ni_stc.h: tidy up NI_M_AI_CFG_FIFO_DATA_REG bits
>    staging: comedi: ni_stc.h: tidy up NI_M_CLK_FOUT2_REG bits
>    staging: comedi: ni_stc.h: tidy up NI_M_PLL_CTRL_REG bits
>    staging: comedi: ni_stc.h: tidy up NI_M_PLL_STATUS_REG bits
>    staging: comedi: ni_stc.h: tidy up NI_M_AI_CFG_BYPASS_FIFO_REG bits
>    staging: comedi: ni_stc.h: tidy up NI_M_AO_CFG_BANK_REG bits
>    staging: comedi: ni_stc.h: tidy up NI_M_AO_REF_ATTENUATION_REG bits
>    staging: comedi: ni_stc.h: tidy up NI_M_CAL_PWM_REG bits
>    staging: comedi: ni_stc.h: tidy up NI_M_PFI_OUT_SEL_REG bits
>    staging: comedi: ni_stc.h: tidy up NI_M_PFI_FILTER_REG bits
>    staging: comedi: ni_stc.h: tidy up NI_M_CDIO_DMA_SEL_REG bits
>    staging: comedi: ni_stc.h: tidy up NI_M_CDIO_STATUS_REG bits
>    staging: comedi: ni_stc.h: tidy up NI_M_CDIO_CMD_REG bits
>    staging: comedi: ni_stc.h: tidy up NI_M_CDI_MODE_REG bits
>    staging: comedi: ni_mio_common: remove BUG() check in ni_cdio_cmd()
>    staging: comedi: ni_stc.h: tidy up NI_M_CDO_MODE_REG bits
>    staging: comedi: ni_stc.h: tidy up NI_M_INTC_ENA_REG bits
>    staging: comedi: ni_stc.h: tidy up NI_M_INTC_STATUS_REG bits
>    staging: comedi: ni_mio_common: remove disabled GPCT functions
>    staging: comedi: ni_stc.h: tidy up Interrupt_A_Ack_Register and bits
>    staging: comedi: ni_stc.h: tidy up Interrupt_B_Ack_Register and bits
>    staging: comedi: ni_stc.h: tidy up AI_Command_2_Register and bits
>    staging: comedi: ni_stc.h: tidy up AO_Command_2_Register and bits
>    staging: comedi: ni_stc.h: tidy up G_Command_Register
>    staging: comedi: ni_stc.h: tidy up AI_Command_1_Register and bits
>    staging: comedi: ni_stc.h: tidy up AO_Command_1_Register and bits
>    staging: comedi: ni_stc.h: tidy up DIO_Output_Register and bits
>    staging: comedi: ni_stc.h: tidy up DIO_Control_Register and bits
>    staging: comedi: ni_stc.h: tidy up AI_Mode_1_Register and bits
>    staging: comedi: ni_stc.h: tidy up AI_Mode_2_Register and bits
>    staging: comedi: ni_stc.h: tidy up AI_*_Load_[AB]_Registers
>    staging: comedi: ni_stc.h: tidy up G_{Mode,Load,Input}*_Register
>    staging: comedi: ni_stc.h: tidy up AO_Mode_1_Register and bits
>    staging: comedi: ni_stc.h: tidy up AO_Mode_2_Register and bits
>    staging: comedi: ni_stc.h: tidy up AO_*_Load_[AB]_Register
>    staging: comedi: ni_stc.h: tidy up Clock_and_FOUT_Register and bits
>    staging: comedi: ni_mio_common: use 'reg' in ni_set_bitfield()
>    staging: comedi: ni_stc.h: tidy up IO_Bidirection_Pin_Register
>    staging: comedi: ni_stc.h: remove unreachable code in RTSI_Output_Bit()
>    staging: comedi: ni_stc.h: tidy up RTSI_Trig_Direction_Register and bits
>    staging: comedi: ni_stc.h: tidy up Interrupt_Control_Register and bits
>    staging: comedi: ni_stc.h: tidy up AI_Output_Control_Register and bits
>    staging: comedi: ni_stc.h: tidy up Analog_Trigger_Etc_Register and bits
>    staging: comedi: ni_stc.h: tidy up AI_START_STOP_Select_Register and bits
>    staging: comedi: ni_stc.h: tidy up AI_Trigger_Select_Register and bits
>    staging: comedi: ni_stc.h: tidy up AI_DIV_Load_A_Register
>    staging: comedi: ni_stc.h: tidy up AO_Start_Select_Register and bits
>    staging: comedi: ni_stc.h: tidy up AO_Trigger_Select_Register and bits
>    staging: comedi: ni_stc.h: tidy up G_Autoincrement_Register
>    staging: comedi: ni_stc.h: tidy up AO_Mode_3_Register and bits
>    staging: comedi: ni_stc.h: tidy up Joint_Reset_Register and bits
>    staging: comedi: ni_stc.h: tidy up Interrupt_A_Enable_Register and bits
>    staging: comedi: ni_stc.h: tidy up Second_IRQ_A_Enable_Register and bits
>    staging: comedi: ni_stc.h: tidy up Interrupt_B_Enable_Register and bits
>    staging: comedi: ni_stc.h: tidy up Second_IRQ_B_Enable_Register and bits
>    staging: comedi: ni_stc.h: tidy up AI_Personal_Register and bits
>    staging: comedi: ni_stc.h: tidy up AO_Personal_Register and bits
>    staging: comedi: ni_stc.h: tidy up RTSI_Trig_[AB]_Output_Register and bits
>    staging: comedi: ni_stc.h: tidy up RTSI_Board_Register
>    staging: comedi: ni_stc.h: tidy up Write_Strobe_*_Register
>    staging: comedi: ni_stc.h: tidy up AO_Output_Control_Register and bits
>    staging: comedi: ni_stc.h: tidy up AI_Mode_3_Register and bits
>    staging: comedi: ni_stc.h: tidy up AI_Status_1_Register and bits
>    staging: comedi: ni_stc.h: tidy up AO_Status_1_Register and bits
>    staging: comedi: ni_stc.h: tidy up G_Status_Register
>    staging: comedi: ni_stc.h: tidy up AI_Status_2_Register
>    staging: comedi: ni_stc.h: tidy up AO_Status_2_Register
>    staging: comedi: ni_stc.h: tidy up DIO_Parallel_Input_Register
>    staging: comedi: ni_stc.h: tidy up G_HW_Save_Register
>    staging: comedi: ni_stc.h: tidy up G_Save_Register
>    staging: comedi: ni_stc.h: tidy up AO_*_Save_Registers
>    staging: comedi: ni_stc.h: tidy up Joint_Status_1_Register
>    staging: comedi: ni_stc.h: tidy up DIO_Serial_Input_Register
>    staging: comedi: ni_stc.h: tidy up Joint_Status_2_Register and bits
>    staging: comedi: ni_stc.h: tidy up AI_*_Save_Registers
>    staging: comedi: ni_stc.h: remove unused GPCT register bit defines
>    staging: comedi: ni_stc.h: tidy up Window_{Address,Data} defines
>    staging: comedi: ni_stc.h: tidy up XXX_Status register and bits
>    staging: comedi: ni_stc.h: tidy up Serial_Command register and bits
>    staging: comedi: ni_stc.h: tidy up Misc_Command register and bits
>    staging: comedi: ni_stc.h: tidy up 8255 register defines
>    staging: comedi: ni_stc.h: tidy up ADC_FIFO_Data_Register
>    staging: comedi: ni_stc.h: tidy up Configuration_Memory_Low register and bits
>    staging: comedi: ni_stc.h: tidy up Configuration_Memory_High register and bits
>    staging: comedi: ni_stc.h: tidy up AO_Configuration register and bits
>    staging: comedi: ni_stc.h: tidy up DAC_FIFO_Data register
>    staging: comedi: ni_stc.h: tidy up DAC[01]_Direct_Data registers
>    staging: comedi: ni_mio_common: remove BUG_ON(gpct_index ...) checks
>    staging: comedi: ni_stc.h: tidy up AI_AO_Select register and bits
>    staging: comedi: ni_stc.h: tidy up G0_G1_Select register and bits
>    staging: comedi: ni_mio_common: move ni_stc_dma_channel_select_bitfield()
>    staging: comedi: ni_stc.h: remove unused _bit* defines
>    staging: comedi: ni_stc.h: rename the NI-611x register defines
>    staging: comedi: ni_stc.h: rename the NI-6143 register defines
>    staging: comedi: ni_stc.h: tidy up the cs5529_configuration_bits
>    staging: comedi: ni_stc.h: tidy up the cs5529_command_bits
>    staging: comedi: ni_stc.h: tidy up the windowed_regs_67xx_61xx
>    staging: comedi: ni_stc.h: final cleanup
>
>   drivers/staging/comedi/drivers/ni_mio_common.c | 2405 +++++++++++-------------
>   drivers/staging/comedi/drivers/ni_pcimio.c     |   17 +-
>   drivers/staging/comedi/drivers/ni_stc.h        | 2237 +++++++++-------------
>   3 files changed, 1969 insertions(+), 2690 deletions(-)
>

Nice job!

Reviewed-by: Ian Abbott <abbotti at mev.co.uk>

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti at mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-


More information about the devel mailing list