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

staging: comedi: comedi_parport: fix parport_insn_config_a()

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.

Also, rename the function to better describe it's use.
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 4c921337
...@@ -109,22 +109,25 @@ static int parport_data_reg_insn_bits(struct comedi_device *dev, ...@@ -109,22 +109,25 @@ static int parport_data_reg_insn_bits(struct comedi_device *dev,
return insn->n; return insn->n;
} }
static int parport_insn_config_a(struct comedi_device *dev, static int parport_data_reg_insn_config(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn,
unsigned int *data)
{ {
struct parport_private *devpriv = dev->private; struct parport_private *devpriv = dev->private;
int ret;
if (data[0]) { ret = comedi_dio_insn_config(dev, s, insn, data, 0xff);
s->io_bits = 0xff; if (ret)
return ret;
if (s->io_bits)
devpriv->c_data &= ~PARPORT_CTRL_BIDIR_ENA; devpriv->c_data &= ~PARPORT_CTRL_BIDIR_ENA;
} else { else
s->io_bits = 0;
devpriv->c_data |= PARPORT_CTRL_BIDIR_ENA; devpriv->c_data |= PARPORT_CTRL_BIDIR_ENA;
}
outb(devpriv->c_data, dev->iobase + PARPORT_CTRL_REG); outb(devpriv->c_data, dev->iobase + PARPORT_CTRL_REG);
return 1; return insn->n;
} }
static int parport_insn_b(struct comedi_device *dev, struct comedi_subdevice *s, static int parport_insn_b(struct comedi_device *dev, struct comedi_subdevice *s,
...@@ -288,7 +291,7 @@ static int parport_attach(struct comedi_device *dev, ...@@ -288,7 +291,7 @@ static int parport_attach(struct comedi_device *dev,
s->maxdata = 1; s->maxdata = 1;
s->range_table = &range_digital; s->range_table = &range_digital;
s->insn_bits = parport_data_reg_insn_bits; s->insn_bits = parport_data_reg_insn_bits;
s->insn_config = parport_insn_config_a; s->insn_config = parport_data_reg_insn_config;
s = &dev->subdevices[1]; s = &dev->subdevices[1];
s->type = COMEDI_SUBD_DI; s->type = COMEDI_SUBD_DI;
......
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