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

staging: comedi: adv_pci1710: remove local var in pci171x_ai_cmd()

The local variable 'mode' is not necessary. We can determine the mode
by checking the cmd->convert_src and cmd->start_src. Do this instead
to clarify the code.
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 73bcf01c
...@@ -958,16 +958,6 @@ static int pci171x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -958,16 +958,6 @@ static int pci171x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
{ {
struct pci1710_private *devpriv = dev->private; struct pci1710_private *devpriv = dev->private;
struct comedi_cmd *cmd = &s->async->cmd; struct comedi_cmd *cmd = &s->async->cmd;
int mode;
if (cmd->convert_src == TRIG_TIMER) {
if (cmd->start_src == TRIG_EXT)
mode = 2;
else
mode = 1;
} else { /* TRIG_EXT */
mode = 3;
}
start_pacer(dev, -1, 0, 0); /* stop pacer */ start_pacer(dev, -1, 0, 0); /* stop pacer */
...@@ -987,30 +977,27 @@ static int pci171x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -987,30 +977,27 @@ static int pci171x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
devpriv->divisor1 = devpriv->next_divisor1; devpriv->divisor1 = devpriv->next_divisor1;
devpriv->divisor2 = devpriv->next_divisor2; devpriv->divisor2 = devpriv->next_divisor2;
switch (mode) { if (cmd->convert_src == TRIG_TIMER) {
case 1:
case 2:
devpriv->CntrlReg |= Control_PACER | Control_IRQEN; devpriv->CntrlReg |= Control_PACER | Control_IRQEN;
if (mode == 2) { if (cmd->start_src == TRIG_EXT) {
devpriv->ai_et_CntrlReg = devpriv->CntrlReg; devpriv->ai_et_CntrlReg = devpriv->CntrlReg;
devpriv->CntrlReg &= devpriv->CntrlReg &=
~(Control_PACER | Control_ONEFH | Control_GATE); ~(Control_PACER | Control_ONEFH | Control_GATE);
devpriv->CntrlReg |= Control_EXT; devpriv->CntrlReg |= Control_EXT;
devpriv->ai_et = 1; devpriv->ai_et = 1;
} else { } else { /* TRIG_NOW */
devpriv->ai_et = 0; devpriv->ai_et = 0;
} }
outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL); outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL);
if (mode != 2) {
if (cmd->start_src == TRIG_NOW) {
/* start pacer */ /* start pacer */
start_pacer(dev, mode, start_pacer(dev, 1,
devpriv->divisor1, devpriv->divisor2); devpriv->divisor1, devpriv->divisor2);
} }
break; } else { /* TRIG_EXT */
case 3:
devpriv->CntrlReg |= Control_EXT | Control_IRQEN; devpriv->CntrlReg |= Control_EXT | Control_IRQEN;
outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL); outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL);
break;
} }
return 0; return 0;
......
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