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

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

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



The comedi core now counts the number of samples added to the async buffer and
detects the end-of-scan and increments the comedi_async 'scans_done' counter.

Remove the private data member 'ai_act_scan' and use the 'scans_done' member
to detect the 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 a3e0316c
Loading
Loading
Loading
Loading
+4 −18
Original line number Original line Diff line number Diff line
@@ -221,7 +221,6 @@ struct pci9118_private {
	unsigned char int_ctrl;
	unsigned char int_ctrl;
	unsigned char ai_cfg;
	unsigned char ai_cfg;
	unsigned int ai_do;		/* what do AI? 0=nothing, 1 to 4 mode */
	unsigned int ai_do;		/* what do AI? 0=nothing, 1 to 4 mode */
	unsigned int ai_act_scan;	/* how many scans we finished */
	unsigned int ai_n_realscanlen;	/*
	unsigned int ai_n_realscanlen;	/*
					 * what we must transfer for one
					 * what we must transfer for one
					 * outgoing scan include front/back adds
					 * outgoing scan include front/back adds
@@ -477,13 +476,7 @@ static void move_block_from_dma(struct comedi_device *dev,
				unsigned short *dma_buffer,
				unsigned short *dma_buffer,
				unsigned int num_samples)
				unsigned int num_samples)
{
{
	struct pci9118_private *devpriv = dev->private;
	struct comedi_cmd *cmd = &s->async->cmd;

	num_samples = defragment_dma_buffer(dev, s, dma_buffer, num_samples);
	num_samples = defragment_dma_buffer(dev, s, dma_buffer, num_samples);
	devpriv->ai_act_scan +=
	    (s->async->cur_chan + num_samples) / cmd->scan_end_arg;

	comedi_buf_write_samples(s, dma_buffer, num_samples);
	comedi_buf_write_samples(s, dma_buffer, num_samples);
}
}


@@ -571,7 +564,6 @@ static int pci9118_ai_cancel(struct comedi_device *dev,
	devpriv->ai_do = 0;
	devpriv->ai_do = 0;
	devpriv->usedma = 0;
	devpriv->usedma = 0;


	devpriv->ai_act_scan = 0;
	devpriv->ai_act_dmapos = 0;
	devpriv->ai_act_dmapos = 0;
	s->async->inttrig = NULL;
	s->async->inttrig = NULL;
	devpriv->ai_neverending = 0;
	devpriv->ai_neverending = 0;
@@ -612,15 +604,11 @@ static void interrupt_pci9118_ai_onesample(struct comedi_device *dev,


	comedi_buf_write_samples(s, &sampl, 1);
	comedi_buf_write_samples(s, &sampl, 1);


	if (s->async->cur_chan == 0) {
		devpriv->ai_act_scan++;
	if (!devpriv->ai_neverending) {
	if (!devpriv->ai_neverending) {
			/* all data sampled? */
		if (s->async->scans_done >= cmd->stop_arg)
			if (devpriv->ai_act_scan >= cmd->stop_arg)
			s->async->events |= COMEDI_CB_EOA;
			s->async->events |= COMEDI_CB_EOA;
	}
	}
}
}
}


static void interrupt_pci9118_ai_dma(struct comedi_device *dev,
static void interrupt_pci9118_ai_dma(struct comedi_device *dev,
				     struct comedi_subdevice *s)
				     struct comedi_subdevice *s)
@@ -651,8 +639,7 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev,
	}
	}


	if (!devpriv->ai_neverending) {
	if (!devpriv->ai_neverending) {
		/* all data sampled? */
		if (s->async->scans_done >= cmd->stop_arg)
		if (devpriv->ai_act_scan >= cmd->stop_arg)
			s->async->events |= COMEDI_CB_EOA;
			s->async->events |= COMEDI_CB_EOA;
	}
	}


@@ -1114,7 +1101,6 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
	inl(dev->iobase + PCI9118_AI_STATUS_REG);
	inl(dev->iobase + PCI9118_AI_STATUS_REG);
	inl(dev->iobase + PCI9118_INT_CTRL_REG);
	inl(dev->iobase + PCI9118_INT_CTRL_REG);


	devpriv->ai_act_scan = 0;
	devpriv->ai_act_dmapos = 0;
	devpriv->ai_act_dmapos = 0;


	if (devpriv->usedma) {
	if (devpriv->usedma) {