From: H Hartley Sweeten Date: Wed, 5 Nov 2014 17:21:06 +0000 (-0700) Subject: staging: comedi: usbduxsigma: use comedi_async 'scans_done' to detect AO EOA X-Git-Tag: firefly_0821_release~176^2~2665^2~396 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=4b8ffac3859155b1f3c5ded5aeda41fedfe5555e;p=firefly-linux-kernel-4.4.55.git staging: comedi: usbduxsigma: use comedi_async 'scans_done' to detect AO EOA Remove the private data member 'ao_sample_count' and use the comedi_async 'scans_done' member to detect the analog output end-of-acquisition. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index 9ee6e0a78578..31b280656a1a 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -166,7 +166,6 @@ struct usbduxsigma_private { /* number of samples to acquire */ int ai_sample_count; - int ao_sample_count; /* time between samples in units of the timer */ unsigned int ai_timer; unsigned int ao_timer; @@ -358,12 +357,10 @@ static void usbduxsigma_ao_handle_urb(struct comedi_device *dev, if (devpriv->ao_counter == 0) { devpriv->ao_counter = devpriv->ao_timer; - if (cmd->stop_src == TRIG_COUNT) { - devpriv->ao_sample_count--; - if (devpriv->ao_sample_count < 0) { - async->events |= COMEDI_CB_EOA; - return; - } + if (cmd->stop_src == TRIG_COUNT && + async->scans_done >= cmd->stop_arg) { + async->events |= COMEDI_CB_EOA; + return; } /* transmit data to the USB bus */ @@ -952,25 +949,6 @@ static int usbduxsigma_ao_cmdtest(struct comedi_device *dev, if (devpriv->ao_timer < 1) err |= -EINVAL; - if (cmd->stop_src == TRIG_COUNT) { - /* not continuous, use counter */ - if (high_speed) { - /* high speed also scans everything at once */ - devpriv->ao_sample_count = cmd->stop_arg * - cmd->scan_end_arg; - } else { - /* - * There's no scan as the scan has been - * handled inside the FX2. Data arrives as - * one packet. - */ - devpriv->ao_sample_count = cmd->stop_arg; - } - } else { - /* continuous acquisition */ - devpriv->ao_sample_count = 0; - } - if (err) return 4;