diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2013-08-26 15:28:51 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-27 16:59:08 -0700 |
commit | 9b3e5aec9b275a6a7bad48f2dc2c2dcfd38a4779 (patch) | |
tree | 68a48209f1f261c183ad048085a5200982786c12 /drivers/staging | |
parent | c7fe22f6f6e5715d29bdfca99358001c0dfbdae6 (diff) |
staging: comedi: dt282x: fix dt282x_dio_insn_config()
This is the (*insn_config) function for a DIO subdevice. It should be
using the data[0] value as the "instruction" to perform on the subdevice.
Use the comedi_dio_insn_config() helper to properly handle instructions.
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>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/comedi/drivers/dt282x.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c index 4a25382e9b86..da3ee859bdbc 100644 --- a/drivers/staging/comedi/drivers/dt282x.c +++ b/drivers/staging/comedi/drivers/dt282x.c @@ -982,29 +982,32 @@ static int dt282x_dio_insn_bits(struct comedi_device *dev, static int dt282x_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) + struct comedi_insn *insn, + unsigned int *data) { struct dt282x_private *devpriv = dev->private; - int mask; + unsigned int chan = CR_CHAN(insn->chanspec); + unsigned int mask; + int ret; - mask = (CR_CHAN(insn->chanspec) < 8) ? 0x00ff : 0xff00; - if (data[0]) - s->io_bits |= mask; + if (chan < 8) + mask = 0x00ff; else - s->io_bits &= ~mask; + mask = 0xff00; + + ret = comedi_dio_insn_config(dev, s, insn, data, mask); + if (ret) + return ret; + devpriv->dacsr &= ~(DT2821_LBOE | DT2821_HBOE); if (s->io_bits & 0x00ff) devpriv->dacsr |= DT2821_LBOE; - else - devpriv->dacsr &= ~DT2821_LBOE; if (s->io_bits & 0xff00) devpriv->dacsr |= DT2821_HBOE; - else - devpriv->dacsr &= ~DT2821_HBOE; outw(devpriv->dacsr, dev->iobase + DT2821_DACSR); - return 1; + return insn->n; } static const struct comedi_lrange *const ai_range_table[] = { |