staging: comedi: ni_pcidio: Mark buffer for writing when setting up DMA.
authorIan Abbott <abbotti@mev.co.uk>
Mon, 9 Jan 2012 15:47:30 +0000 (15:47 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Feb 2012 18:00:36 +0000 (10:00 -0800)
When setting up the DMA for 'read' streaming acquisition on the DIO
subdevice, mark the whole buffer as writable before starting the DMA.
This prevents a spurious detection of a DMA overwrite of good data
during the first interrupt.

Problem reported by Nicholas Nell.  Fix suggested by Frank Mori Hess.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/ni_pcidio.c

index 045a4c00f3462c5d3266eb88e4fa206bfdb6b72b..c9e5f2b2dfbb445dc52c47efcd680d648195e845 100644 (file)
@@ -1012,6 +1012,9 @@ static int setup_mite_dma(struct comedi_device *dev, struct comedi_subdevice *s)
 
        devpriv->di_mite_chan->dir = COMEDI_INPUT;
 
+       /* write alloc the entire buffer */
+       comedi_buf_write_alloc(s->async, s->async->prealloc_bufsz);
+
        mite_prep_dma(devpriv->di_mite_chan, 32, 32);
 
        mite_dma_arm(devpriv->di_mite_chan);