From: H Hartley Sweeten Date: Wed, 25 Sep 2013 22:35:26 +0000 (-0700) Subject: staging: comedi: pcl726: remove 'bipolar' from the private data X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=b4f58e1f68ae9192d6c3a7dffa09ac2f2ec41fe0;p=linux-beck.git 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: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/pcl726.c b/drivers/staging/comedi/drivers/pcl726.c index d1e1e5e1e996..17a4095be11b 100644 --- a/drivers/staging/comedi/drivers/pcl726.c +++ b/drivers/staging/comedi/drivers/pcl726.c @@ -183,8 +183,6 @@ static const struct pcl726_board boardtypes[] = { }; struct pcl726_private { - - int bipolar[12]; const struct comedi_lrange *rangelist[12]; unsigned int ao_readback[12]; }; @@ -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 pcl726_private *devpriv = dev->private; + unsigned int chan = CR_CHAN(insn->chanspec); + unsigned int range = CR_RANGE(insn->chanspec); int hi, lo; int n; - int chan = CR_CHAN(insn->chanspec); for (n = 0; n < insn->n; n++) { lo = data[n] & 0xff; hi = (data[n] >> 8) & 0xf; - if (devpriv->bipolar[chan]) + if (comedi_chan_range_is_bipolar(s, chan, range)) hi ^= 0x8; /* * the programming info did not say which order @@ -279,10 +278,8 @@ static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (!devpriv) return -ENOMEM; - for (i = 0; i < 12; i++) { - devpriv->bipolar[i] = 0; + for (i = 0; i < 12; i++) devpriv->rangelist[i] = &range_unknown; - } #ifdef ACL6126_IRQ irq = 0; @@ -339,9 +336,6 @@ static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it) j = 0; } 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];