mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-09 19:51:25 -04:00
staging: comedi: ni_mio_common: use comedi_dio_update_state()
Use comedi_dio_update_state() to handle the boilerplate code to update the subdevice s->state. Remove the DEBUG_DIO, its just added noise. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
b3ff824a81
commit
6171667a81
@@ -3547,28 +3547,22 @@ static int ni_dio_insn_config(struct comedi_device *dev,
|
||||
|
||||
static int ni_dio_insn_bits(struct comedi_device *dev,
|
||||
struct comedi_subdevice *s,
|
||||
struct comedi_insn *insn, unsigned int *data)
|
||||
struct comedi_insn *insn,
|
||||
unsigned int *data)
|
||||
{
|
||||
struct ni_private *devpriv = dev->private;
|
||||
|
||||
#ifdef DEBUG_DIO
|
||||
printk("ni_dio_insn_bits() mask=0x%x bits=0x%x\n", data[0], data[1]);
|
||||
#endif
|
||||
/* Make sure we're not using the serial part of the dio */
|
||||
if ((data[0] & (DIO_SDIN | DIO_SDOUT)) && devpriv->serial_interval_ns)
|
||||
return -EBUSY;
|
||||
|
||||
if (data[0]) {
|
||||
/* Perform check to make sure we're not using the
|
||||
serial part of the dio */
|
||||
if ((data[0] & (DIO_SDIN | DIO_SDOUT))
|
||||
&& devpriv->serial_interval_ns)
|
||||
return -EBUSY;
|
||||
|
||||
s->state &= ~data[0];
|
||||
s->state |= (data[0] & data[1]);
|
||||
if (comedi_dio_update_state(s, data)) {
|
||||
devpriv->dio_output &= ~DIO_Parallel_Data_Mask;
|
||||
devpriv->dio_output |= DIO_Parallel_Data_Out(s->state);
|
||||
devpriv->stc_writew(dev, devpriv->dio_output,
|
||||
DIO_Output_Register);
|
||||
}
|
||||
|
||||
data[1] = devpriv->stc_readw(dev, DIO_Parallel_Input_Register);
|
||||
|
||||
return insn->n;
|
||||
@@ -3598,16 +3592,9 @@ static int ni_m_series_dio_insn_bits(struct comedi_device *dev,
|
||||
{
|
||||
struct ni_private *devpriv __maybe_unused = dev->private;
|
||||
|
||||
#ifdef DEBUG_DIO
|
||||
printk("ni_m_series_dio_insn_bits() mask=0x%x bits=0x%x\n", data[0],
|
||||
data[1]);
|
||||
#endif
|
||||
|
||||
if (data[0]) {
|
||||
s->state &= ~data[0];
|
||||
s->state |= (data[0] & data[1]);
|
||||
if (comedi_dio_update_state(s, data))
|
||||
ni_writel(s->state, M_Offset_Static_Digital_Output);
|
||||
}
|
||||
|
||||
data[1] = ni_readl(M_Offset_Static_Digital_Input);
|
||||
|
||||
return insn->n;
|
||||
@@ -5355,20 +5342,20 @@ static int ni_config_filter(struct comedi_device *dev, unsigned pfi_channel,
|
||||
|
||||
static int ni_pfi_insn_bits(struct comedi_device *dev,
|
||||
struct comedi_subdevice *s,
|
||||
struct comedi_insn *insn, unsigned int *data)
|
||||
struct comedi_insn *insn,
|
||||
unsigned int *data)
|
||||
{
|
||||
const struct ni_board_struct *board = comedi_board(dev);
|
||||
struct ni_private *devpriv __maybe_unused = dev->private;
|
||||
|
||||
if ((board->reg_type & ni_reg_m_series_mask) == 0) {
|
||||
if (!(board->reg_type & ni_reg_m_series_mask))
|
||||
return -ENOTSUPP;
|
||||
}
|
||||
if (data[0]) {
|
||||
s->state &= ~data[0];
|
||||
s->state |= (data[0] & data[1]);
|
||||
|
||||
if (comedi_dio_update_state(s, data))
|
||||
ni_writew(s->state, M_Offset_PFI_DO);
|
||||
}
|
||||
|
||||
data[1] = ni_readw(M_Offset_PFI_DI);
|
||||
|
||||
return insn->n;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user