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

staging: comedi: pcl726: remove 'bipolar' from the private data

These flags are set in the private data during the attach to indicate
if the range for each channel is bipolar or unipolar. Use the helper
function conedi_chan_range_is_bipolar() to determine this by checking
the range_table_list directly.
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 49162116
...@@ -183,8 +183,6 @@ static const struct pcl726_board boardtypes[] = { ...@@ -183,8 +183,6 @@ static const struct pcl726_board boardtypes[] = {
}; };
struct pcl726_private { struct pcl726_private {
int bipolar[12];
const struct comedi_lrange *rangelist[12]; const struct comedi_lrange *rangelist[12];
unsigned int ao_readback[12]; unsigned int ao_readback[12];
}; };
...@@ -193,14 +191,15 @@ static int pcl726_ao_insn(struct comedi_device *dev, struct comedi_subdevice *s, ...@@ -193,14 +191,15 @@ static int pcl726_ao_insn(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct pcl726_private *devpriv = dev->private; struct pcl726_private *devpriv = dev->private;
unsigned int chan = CR_CHAN(insn->chanspec);
unsigned int range = CR_RANGE(insn->chanspec);
int hi, lo; int hi, lo;
int n; int n;
int chan = CR_CHAN(insn->chanspec);
for (n = 0; n < insn->n; n++) { for (n = 0; n < insn->n; n++) {
lo = data[n] & 0xff; lo = data[n] & 0xff;
hi = (data[n] >> 8) & 0xf; hi = (data[n] >> 8) & 0xf;
if (devpriv->bipolar[chan]) if (comedi_chan_range_is_bipolar(s, chan, range))
hi ^= 0x8; hi ^= 0x8;
/* /*
* the programming info did not say which order * the programming info did not say which order
...@@ -279,10 +278,8 @@ static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -279,10 +278,8 @@ static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it)
if (!devpriv) if (!devpriv)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < 12; i++) { for (i = 0; i < 12; i++)
devpriv->bipolar[i] = 0;
devpriv->rangelist[i] = &range_unknown; devpriv->rangelist[i] = &range_unknown;
}
#ifdef ACL6126_IRQ #ifdef ACL6126_IRQ
irq = 0; irq = 0;
...@@ -339,9 +336,6 @@ static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -339,9 +336,6 @@ static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it)
j = 0; j = 0;
} }
devpriv->rangelist[i] = board->range_type_list[j]; devpriv->rangelist[i] = board->range_type_list[j];
if (devpriv->rangelist[i]->range[0].min ==
-devpriv->rangelist[i]->range[0].max)
devpriv->bipolar[i] = 1; /* bipolar range */
} }
s = &dev->subdevices[1]; s = &dev->subdevices[1];
......
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