Commit 17733219 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: ni_stc.h: add a 'is_m_series' flag to private data

The (board->reg_type & ni_reg_m_series_mask) test is commonly used
in ni_mio_common.c to detect if the driver is being used with a
National Instruments "M series" DAQ board. Simplify the code a bit
by adding an 'is_m_series' bit-field flag to the private data.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0fd90b74
...@@ -1540,6 +1540,8 @@ static int pcimio_auto_attach(struct comedi_device *dev, ...@@ -1540,6 +1540,8 @@ static int pcimio_auto_attach(struct comedi_device *dev,
devpriv->writel = pcimio_writel; devpriv->writel = pcimio_writel;
if (board->reg_type & ni_reg_m_series_mask) { if (board->reg_type & ni_reg_m_series_mask) {
devpriv->is_m_series = 1;
devpriv->stc_writew = m_series_stc_writew; devpriv->stc_writew = m_series_stc_writew;
devpriv->stc_readw = m_series_stc_readw; devpriv->stc_readw = m_series_stc_readw;
devpriv->stc_writel = m_series_stc_writel; devpriv->stc_writel = m_series_stc_writel;
...@@ -1573,7 +1575,7 @@ static int pcimio_auto_attach(struct comedi_device *dev, ...@@ -1573,7 +1575,7 @@ static int pcimio_auto_attach(struct comedi_device *dev,
if (devpriv->gpct_mite_ring[1] == NULL) if (devpriv->gpct_mite_ring[1] == NULL)
return -ENOMEM; return -ENOMEM;
if (board->reg_type & ni_reg_m_series_mask) if (devpriv->is_m_series)
m_series_init_eeprom_buffer(dev); m_series_init_eeprom_buffer(dev);
if (board->reg_type == ni_reg_6143) if (board->reg_type == ni_reg_6143)
init_6143(dev); init_6143(dev);
......
...@@ -1503,6 +1503,8 @@ struct ni_private { ...@@ -1503,6 +1503,8 @@ struct ni_private {
struct mite_dma_descriptor_ring *ao_mite_ring; struct mite_dma_descriptor_ring *ao_mite_ring;
struct mite_dma_descriptor_ring *cdo_mite_ring; struct mite_dma_descriptor_ring *cdo_mite_ring;
struct mite_dma_descriptor_ring *gpct_mite_ring[NUM_GPCT]; struct mite_dma_descriptor_ring *gpct_mite_ring[NUM_GPCT];
unsigned int is_m_series:1;
}; };
#endif /* _COMEDI_NI_STC_H */ #endif /* _COMEDI_NI_STC_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment