staging: comedi: vmk80xx: tidy up vmk80xx_cnt_insn_config()
Tidy up this (*insn_config) function to follow the normal format in comedi drivers. INSN_CONFIG_RESET instructions do not have any extra parameters (insn->n is always 1) so the for loop used to write the packet doesn't make any sense. Remove it and just write the single packet. 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>
This commit is contained in:
parent
8518a52c44
commit
a4a75b2101
1 changed files with 20 additions and 26 deletions
|
@ -551,20 +551,14 @@ static int vmk80xx_cnt_insn_config(struct comedi_device *dev,
|
||||||
unsigned int *data)
|
unsigned int *data)
|
||||||
{
|
{
|
||||||
struct vmk80xx_private *devpriv = dev->private;
|
struct vmk80xx_private *devpriv = dev->private;
|
||||||
unsigned int insn_cmd;
|
unsigned int chan = CR_CHAN(insn->chanspec);
|
||||||
int chan;
|
|
||||||
int cmd;
|
int cmd;
|
||||||
int reg;
|
int reg;
|
||||||
int n;
|
int ret;
|
||||||
|
|
||||||
insn_cmd = data[0];
|
|
||||||
if (insn_cmd != INSN_CONFIG_RESET)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
down(&devpriv->limit_sem);
|
down(&devpriv->limit_sem);
|
||||||
|
switch (data[0]) {
|
||||||
chan = CR_CHAN(insn->chanspec);
|
case INSN_CONFIG_RESET:
|
||||||
|
|
||||||
if (devpriv->model == VMK8055_MODEL) {
|
if (devpriv->model == VMK8055_MODEL) {
|
||||||
if (!chan) {
|
if (!chan) {
|
||||||
cmd = VMK8055_CMD_RST_CNT1;
|
cmd = VMK8055_CMD_RST_CNT1;
|
||||||
|
@ -573,19 +567,19 @@ static int vmk80xx_cnt_insn_config(struct comedi_device *dev,
|
||||||
cmd = VMK8055_CMD_RST_CNT2;
|
cmd = VMK8055_CMD_RST_CNT2;
|
||||||
reg = VMK8055_CNT2_REG;
|
reg = VMK8055_CNT2_REG;
|
||||||
}
|
}
|
||||||
|
|
||||||
devpriv->usb_tx_buf[reg] = 0x00;
|
devpriv->usb_tx_buf[reg] = 0x00;
|
||||||
} else {
|
} else {
|
||||||
cmd = VMK8061_CMD_RST_CNT;
|
cmd = VMK8061_CMD_RST_CNT;
|
||||||
}
|
}
|
||||||
|
ret = vmk80xx_write_packet(dev, cmd);
|
||||||
for (n = 0; n < insn->n; n++)
|
|
||||||
if (vmk80xx_write_packet(dev, cmd))
|
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
ret = -EINVAL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
up(&devpriv->limit_sem);
|
up(&devpriv->limit_sem);
|
||||||
|
|
||||||
return n;
|
return ret ? ret : insn->n;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vmk80xx_cnt_insn_write(struct comedi_device *dev,
|
static int vmk80xx_cnt_insn_write(struct comedi_device *dev,
|
||||||
|
|
Loading…
Add table
Reference in a new issue