Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4b8ffac3 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman
Browse files

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: 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 88340999
Loading
Loading
Loading
Loading
+4 −26
Original line number Original line Diff line number Diff line
@@ -166,7 +166,6 @@ struct usbduxsigma_private {


	/* number of samples to acquire */
	/* number of samples to acquire */
	int ai_sample_count;
	int ai_sample_count;
	int ao_sample_count;
	/* time between samples in units of the timer */
	/* time between samples in units of the timer */
	unsigned int ai_timer;
	unsigned int ai_timer;
	unsigned int ao_timer;
	unsigned int ao_timer;
@@ -358,13 +357,11 @@ static void usbduxsigma_ao_handle_urb(struct comedi_device *dev,
	if (devpriv->ao_counter == 0) {
	if (devpriv->ao_counter == 0) {
		devpriv->ao_counter = devpriv->ao_timer;
		devpriv->ao_counter = devpriv->ao_timer;


		if (cmd->stop_src == TRIG_COUNT) {
		if (cmd->stop_src == TRIG_COUNT &&
			devpriv->ao_sample_count--;
		    async->scans_done >= cmd->stop_arg) {
			if (devpriv->ao_sample_count < 0) {
			async->events |= COMEDI_CB_EOA;
			async->events |= COMEDI_CB_EOA;
			return;
			return;
		}
		}
		}


		/* transmit data to the USB bus */
		/* transmit data to the USB bus */
		datap = urb->transfer_buffer;
		datap = urb->transfer_buffer;
@@ -952,25 +949,6 @@ static int usbduxsigma_ao_cmdtest(struct comedi_device *dev,
	if (devpriv->ao_timer < 1)
	if (devpriv->ao_timer < 1)
		err |= -EINVAL;
		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)
	if (err)
		return 4;
		return 4;