staging: comedi: pcl711: handle cmd->stop_src and stop_arg
The interrupt handler used to support asynchronous commands on the AI
subdevice currently marks the command as finished (setting the "end of
acquisition" event flag and returning to software-triggered acquisition
mode) once it has decremented `devpriv->ntrig` to 0. However, nothing
sets `devpriv->ntrig`, as noted in the "FIXME" comment.
If the `stop_src` setting of the asynchronous command is `TRIG_COUNT`,
then the `stop_arg` setting indicates the number of scans to be
performed in the overall acquisition. (Otherwise, `stop_src` will be
`TRIG_NONE`, meaning the acquisition should run indefinitely until
cancelled.) When starting the acquisition in `pcl711_ai_cmd()`, set
`devpriv->ntrig` to the number of scans to be performed (`stop_arg`) if
`stop_src` is `TRIG_COUNT`. In the interrupt handler, don't decrement
`devpriv->ntrig` or handle end of acquision unless `stop_src` is
`TRIG_COUNT`.
Also check for an empty acquisition in `pcl711_ai_cmd()`, i.e. one where
`stop_src` is `TRIG_COUNT` and `stop_arg` is zero and just mark end of
acquisition without actually setting up the interrupts in this case.
Also change the type of the `ntrig` member of the private data structure
to `unsigned int` as it should be (same type as `stop_arg`).
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>