mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-09 14:56:54 -04:00
staging: comedi: hwdrv_apci3120: use comedi_dio_update_state()
Use comedi_dio_update_state() to handle the boilerplate code to update the subdevice s->state. 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
f6b316bcd8
commit
2da43beab0
@@ -2175,21 +2175,16 @@ static int apci3120_do_insn_bits(struct comedi_device *dev,
|
||||
unsigned int *data)
|
||||
{
|
||||
struct addi_private *devpriv = dev->private;
|
||||
unsigned int mask = data[0];
|
||||
unsigned int bits = data[1];
|
||||
unsigned int val;
|
||||
|
||||
/* The do channels are bits 7:4 of the do register */
|
||||
val = devpriv->b_DigitalOutputRegister >> 4;
|
||||
if (mask) {
|
||||
val &= ~mask;
|
||||
val |= (bits & mask);
|
||||
devpriv->b_DigitalOutputRegister = val << 4;
|
||||
if (comedi_dio_update_state(s, data)) {
|
||||
/* The do channels are bits 7:4 of the do register */
|
||||
devpriv->b_DigitalOutputRegister = s->state << 4;
|
||||
|
||||
outb(val << 4, devpriv->iobase + APCI3120_DIGITAL_OUTPUT);
|
||||
outb(devpriv->b_DigitalOutputRegister,
|
||||
devpriv->iobase + APCI3120_DIGITAL_OUTPUT);
|
||||
}
|
||||
|
||||
data[1] = val;
|
||||
data[1] = s->state;
|
||||
|
||||
return insn->n;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user