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

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: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f6b316bc
...@@ -2175,21 +2175,16 @@ static int apci3120_do_insn_bits(struct comedi_device *dev, ...@@ -2175,21 +2175,16 @@ static int apci3120_do_insn_bits(struct comedi_device *dev,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private; 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 */ if (comedi_dio_update_state(s, data)) {
val = devpriv->b_DigitalOutputRegister >> 4; /* The do channels are bits 7:4 of the do register */
if (mask) { devpriv->b_DigitalOutputRegister = s->state << 4;
val &= ~mask;
val |= (bits & mask);
devpriv->b_DigitalOutputRegister = val << 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; return insn->n;
} }
......
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