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

staging: comedi: s626: use comedi_async 'scans_done' to detect EOA

Remove the private data member 'ai_sample_count' and use the comedi_async
'scans_done' member to detect the end-of-acquisition.

Also, remove the unnecessary COMEDI_CB_EOS event. The core automatically
detects and adds that event.
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 b03130b6
...@@ -78,7 +78,6 @@ struct s626_buffer_dma { ...@@ -78,7 +78,6 @@ struct s626_buffer_dma {
struct s626_private { struct s626_private {
uint8_t ai_cmd_running; /* ai_cmd is running */ uint8_t ai_cmd_running; /* ai_cmd is running */
int ai_sample_count; /* number of samples to acquire */
unsigned int ai_sample_timer; /* time between samples in unsigned int ai_sample_timer; /* time between samples in
* units of the timer */ * units of the timer */
int ai_convert_count; /* conversion counter */ int ai_convert_count; /* conversion counter */
...@@ -1496,16 +1495,11 @@ static bool s626_handle_eos_interrupt(struct comedi_device *dev) ...@@ -1496,16 +1495,11 @@ static bool s626_handle_eos_interrupt(struct comedi_device *dev)
comedi_buf_write_samples(s, &tempdata, 1); comedi_buf_write_samples(s, &tempdata, 1);
} }
/* end of scan occurs */ if (cmd->stop_src == TRIG_COUNT && async->scans_done >= cmd->stop_arg)
async->events |= COMEDI_CB_EOS; async->events |= COMEDI_CB_EOA;
if (cmd->stop_src == TRIG_COUNT) { if (async->events & COMEDI_CB_CANCEL_MASK)
devpriv->ai_sample_count--; devpriv->ai_cmd_running = 0;
if (devpriv->ai_sample_count <= 0) {
devpriv->ai_cmd_running = 0;
async->events |= COMEDI_CB_EOA;
}
}
if (devpriv->ai_cmd_running && cmd->scan_begin_src == TRIG_EXT) if (devpriv->ai_cmd_running && cmd->scan_begin_src == TRIG_EXT)
s626_dio_set_irq(dev, cmd->scan_begin_arg); s626_dio_set_irq(dev, cmd->scan_begin_arg);
...@@ -2091,8 +2085,6 @@ static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -2091,8 +2085,6 @@ static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
break; break;
} }
devpriv->ai_sample_count = cmd->stop_arg;
s626_reset_adc(dev, ppl); s626_reset_adc(dev, ppl);
switch (cmd->start_src) { switch (cmd->start_src) {
......
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