diff options
| author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2014-04-23 16:06:59 -0700 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-04-25 15:07:40 -0700 |
| commit | eec2f4efb1d8bbe072b6918da3afdcfdf8259492 (patch) | |
| tree | b5476ae8a2b6c44d34ae450d6c8e8bb67267ccbf | |
| parent | c56cad003decb41d5690ab7b5b74b89d3e3471ba (diff) | |
staging: comedi: adv_pci1710: absorb pci171x_ai_docmd_and_mode()
This helper function is called by the ai (*do_cmd) to setup and
start the async command based on the "mode" of operation. This
"mode" is determined by the cmd convert_src and start_src.
Move this "mode" determination and combine the functions.
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>
| -rw-r--r-- | drivers/staging/comedi/drivers/adv_pci1710.c | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 60b926e5062a..6ab78bb629be 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -947,16 +947,22 @@ static irqreturn_t interrupt_service_pci1710(int irq, void *d) return IRQ_HANDLED; } -/* -============================================================================== -*/ -static int pci171x_ai_docmd_and_mode(int mode, struct comedi_device *dev, - struct comedi_subdevice *s) +static int pci171x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { struct pci1710_private *devpriv = dev->private; struct comedi_cmd *cmd = &s->async->cmd; unsigned int divisor1 = 0, divisor2 = 0; unsigned int seglen; + 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 */ @@ -1111,25 +1117,6 @@ static int pci171x_ai_cmdtest(struct comedi_device *dev, /* ============================================================================== */ -static int pci171x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) -{ - struct comedi_cmd *cmd = &s->async->cmd; - - if (cmd->convert_src == TRIG_TIMER) { /* mode 1 and 2 */ - return pci171x_ai_docmd_and_mode(cmd->start_src == - TRIG_EXT ? 2 : 1, dev, - s); - } - if (cmd->convert_src == TRIG_EXT) { /* mode 3 */ - return pci171x_ai_docmd_and_mode(3, dev, s); - } - - return -1; -} - -/* -============================================================================== -*/ static int pci171x_reset(struct comedi_device *dev) { const struct boardtype *this_board = comedi_board(dev); |
