|
@@ -513,9 +513,8 @@ static int serial_2002_open(struct comedi_device *dev)
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
- if (sign) {
|
|
|
+ if (sign)
|
|
|
min = -min;
|
|
|
- }
|
|
|
cur_config[channel].min
|
|
|
= min;
|
|
|
}
|
|
@@ -554,9 +553,8 @@ static int serial_2002_open(struct comedi_device *dev)
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
- if (sign) {
|
|
|
+ if (sign)
|
|
|
max = -max;
|
|
|
- }
|
|
|
cur_config[channel].max
|
|
|
= max;
|
|
|
}
|
|
@@ -619,9 +617,8 @@ static int serial_2002_open(struct comedi_device *dev)
|
|
|
int j, chan;
|
|
|
|
|
|
for (chan = 0, j = 0; j < 32; j++) {
|
|
|
- if (c[j].kind == kind) {
|
|
|
+ if (c[j].kind == kind)
|
|
|
chan++;
|
|
|
- }
|
|
|
}
|
|
|
s = &dev->subdevices[i];
|
|
|
s->n_chan = chan;
|
|
@@ -646,9 +643,8 @@ static int serial_2002_open(struct comedi_device *dev)
|
|
|
}
|
|
|
for (chan = 0, j = 0; j < 32; j++) {
|
|
|
if (c[j].kind == kind) {
|
|
|
- if (mapping) {
|
|
|
+ if (mapping)
|
|
|
mapping[chan] = j;
|
|
|
- }
|
|
|
if (range) {
|
|
|
range[j].length = 1;
|
|
|
range[j].range.min =
|
|
@@ -701,9 +697,8 @@ err_alloc_configs:
|
|
|
|
|
|
static void serial_2002_close(struct comedi_device *dev)
|
|
|
{
|
|
|
- if (!IS_ERR(devpriv->tty) && (devpriv->tty != 0)) {
|
|
|
+ if (!IS_ERR(devpriv->tty) && (devpriv->tty != 0))
|
|
|
filp_close(devpriv->tty, 0);
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
static int serial2002_di_rinsn(struct comedi_device *dev,
|
|
@@ -720,9 +715,8 @@ static int serial2002_di_rinsn(struct comedi_device *dev,
|
|
|
poll_digital(devpriv->tty, chan);
|
|
|
while (1) {
|
|
|
read = serial_read(devpriv->tty, 1000);
|
|
|
- if (read.kind != is_digital || read.index == chan) {
|
|
|
+ if (read.kind != is_digital || read.index == chan)
|
|
|
break;
|
|
|
- }
|
|
|
}
|
|
|
data[n] = read.value;
|
|
|
}
|
|
@@ -762,9 +756,8 @@ static int serial2002_ai_rinsn(struct comedi_device *dev,
|
|
|
poll_channel(devpriv->tty, chan);
|
|
|
while (1) {
|
|
|
read = serial_read(devpriv->tty, 1000);
|
|
|
- if (read.kind != is_channel || read.index == chan) {
|
|
|
+ if (read.kind != is_channel || read.index == chan)
|
|
|
break;
|
|
|
- }
|
|
|
}
|
|
|
data[n] = read.value;
|
|
|
}
|
|
@@ -798,9 +791,8 @@ static int serial2002_ao_rinsn(struct comedi_device *dev,
|
|
|
int n;
|
|
|
int chan = CR_CHAN(insn->chanspec);
|
|
|
|
|
|
- for (n = 0; n < insn->n; n++) {
|
|
|
+ for (n = 0; n < insn->n; n++)
|
|
|
data[n] = devpriv->ao_readback[chan];
|
|
|
- }
|
|
|
|
|
|
return n;
|
|
|
}
|
|
@@ -819,9 +811,8 @@ static int serial2002_ei_rinsn(struct comedi_device *dev,
|
|
|
poll_channel(devpriv->tty, chan);
|
|
|
while (1) {
|
|
|
read = serial_read(devpriv->tty, 1000);
|
|
|
- if (read.kind != is_channel || read.index == chan) {
|
|
|
+ if (read.kind != is_channel || read.index == chan)
|
|
|
break;
|
|
|
- }
|
|
|
}
|
|
|
data[n] = read.value;
|
|
|
}
|
|
@@ -835,9 +826,8 @@ static int serial2002_attach(struct comedi_device *dev,
|
|
|
|
|
|
printk("comedi%d: serial2002: ", dev->minor);
|
|
|
dev->board_name = thisboard->name;
|
|
|
- if (alloc_private(dev, sizeof(struct serial2002_private)) < 0) {
|
|
|
+ if (alloc_private(dev, sizeof(struct serial2002_private)) < 0)
|
|
|
return -ENOMEM;
|
|
|
- }
|
|
|
dev->open = serial_2002_open;
|
|
|
dev->close = serial_2002_close;
|
|
|
devpriv->port = it->options[0];
|