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

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

staging: comedi: adl_pci9118: absorb move_block_from_dma()



Absorb this simple helper function into interrupt_pci9118_ai_dma().

Remove the unnecessary local variables 'sampls' and 'm'.

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 6250d982
Loading
Loading
Loading
Loading
+7 −17
Original line number Original line Diff line number Diff line
@@ -471,15 +471,6 @@ static unsigned int defragment_dma_buffer(struct comedi_device *dev,
	return j;
	return j;
}
}


static void move_block_from_dma(struct comedi_device *dev,
				struct comedi_subdevice *s,
				unsigned short *dma_buffer,
				unsigned int num_samples)
{
	num_samples = defragment_dma_buffer(dev, s, dma_buffer, num_samples);
	comedi_buf_write_samples(s, dma_buffer, num_samples);
}

static void pci9118_exttrg_enable(struct comedi_device *dev, bool enable)
static void pci9118_exttrg_enable(struct comedi_device *dev, bool enable)
{
{
	struct pci9118_private *devpriv = dev->private;
	struct pci9118_private *devpriv = dev->private;
@@ -616,9 +607,10 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev,
	struct pci9118_private *devpriv = dev->private;
	struct pci9118_private *devpriv = dev->private;
	struct comedi_cmd *cmd = &s->async->cmd;
	struct comedi_cmd *cmd = &s->async->cmd;
	struct pci9118_dmabuf *dmabuf = &devpriv->dmabuf[devpriv->dma_actbuf];
	struct pci9118_dmabuf *dmabuf = &devpriv->dmabuf[devpriv->dma_actbuf];
	unsigned int next_dma_buf, samplesinbuf, sampls, m;
	unsigned int nsamples;
	unsigned int next_dma_buf;


	samplesinbuf = dmabuf->use_size >> 1;	/* number of received samples */
	nsamples = dmabuf->use_size >> 1;	/* number of received samples */


	if (devpriv->dma_doublebuf) {	/*
	if (devpriv->dma_doublebuf) {	/*
					 * switch DMA buffers if is used
					 * switch DMA buffers if is used
@@ -630,12 +622,10 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev,
			interrupt_pci9118_ai_mode4_switch(dev, next_dma_buf);
			interrupt_pci9118_ai_mode4_switch(dev, next_dma_buf);
	}
	}


	if (samplesinbuf) {
	if (nsamples) {
		/* how many samples is to end of buffer */
		nsamples = defragment_dma_buffer(dev, s, dmabuf->virt,
		m = s->async->prealloc_bufsz >> 1;
						 nsamples);
		sampls = m;
		comedi_buf_write_samples(s, dmabuf->virt, nsamples);
		move_block_from_dma(dev, s, dmabuf->virt, samplesinbuf);
		m = m - sampls;		/* m=how many samples was transferred */
	}
	}


	if (!devpriv->ai_neverending) {
	if (!devpriv->ai_neverending) {