Use the helper function to check the range type instead of relying on the
value. For aesthetics, rename the local variable used for the range.
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>
unsigned int *data)
{
unsigned int chan = CR_CHAN(insn->chanspec);
- unsigned int rang = CR_RANGE(insn->chanspec);
+ unsigned int range = CR_RANGE(insn->chanspec);
unsigned int aref = CR_AREF(insn->chanspec);
- unsigned int entry = 0;
+ unsigned int entry;
unsigned int tmp;
int ret;
int i;
- entry |= ME4000_AI_LIST_RANGE(rang);
- entry |= chan;
+ entry = chan | ME4000_AI_LIST_RANGE(range);
if (aref == AREF_DIFF) {
if (!(s->subdev_flags && SDF_DIFF)) {
dev_err(dev->class_dev,
return -EINVAL;
}
- if (rang == 0 || rang == 1) {
+ if (!comedi_range_is_bipolar(s, range)) {
dev_err(dev->class_dev,
"Range must be bipolar when aref = diff\n");
return -EINVAL;