From: Ian Abbott Date: Thu, 26 Sep 2013 09:16:38 +0000 (+0100) Subject: staging: comedi: pcl711: handle cmd->stop_src and stop_arg X-Git-Tag: omap-for-v3.13/fixes-for-merge-window-take2~62^2~565 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ce4e57b9afea13711606839acd382256d201306;p=pandora-kernel.git 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 Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- Reading git-diff-tree failed