linux/drivers/staging
Ian Abbott bb4a51a1b5 staging: comedi: adl_pci9118: try and avoid unnecessary DMA restart
`interrupt_pci9118_ai_dma()` is called on interrupt to transfer data
from DMA buffers into the comedi async data buffer.  Currently it always
restarts DMA.  If double buffering, it restarts DMA on the next DMA
buffer before processing the current DMA buffer, otherwise it restarts
DMA on the same DMA buffer after it has been processed.

For single buffering we can avoid restarting the DMA transfer by
checking the async event flags after the current buffer has been
processed, which is easy.

For double buffering, we need to know how many valid samples there are
in the current buffer before it has been processed and determine whether
there is enough to complete the acquisition.  Call new function
`valid_samples_in_act_dma_buf()` to determine the number of valid
samples in the current DMA buffer, and compare that with the result of
`comedi_nsamples_left()` to determine if DMA needs to be restarted.
(`comedi_nsamples_left()` needs an upper bound to clamp to, so use the
number of valid samples in the DMA buffer plus one for our test.)

It is still possible for DMA to be restarted unnecessarily in the double
buffer case if a `COMEDI_CB_OVERFLOW` event occurs while copying to the
comedi async buffer, but it doesn't really matter.  The ongoing DMA
operation will get disabled when the subdevice's `cancel()` handler is
called when the events are handled later in the interrupt service
routine (as it does currently).

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-12-02 16:31:20 -08:00
..
android staging: android: ion: Deletion of unnecessary checks before two function calls 2014-11-26 13:42:53 -08:00
board
clocking-wizard staging: clocking-wizard: Contain macro argument in parenthesis 2014-10-29 17:25:53 +08:00
comedi staging: comedi: adl_pci9118: try and avoid unnecessary DMA restart 2014-12-02 16:31:20 -08:00
cptm1217 staging: cptm1217: Remove useless cast on void pointer 2014-10-30 13:05:46 -07:00
dgap Drivers:staging:dgap: Added a blank line after declaration 2014-11-26 14:00:22 -08:00
dgnc staging: dgnc: Remove useless cast on void pointer 2014-10-30 13:05:46 -07:00
emxx_udc staging: emxx_udc: use USB API functions rather than constants 2014-10-30 13:20:42 -07:00
ft1000 staging: ft1000: Logging message neatening 2014-11-03 16:36:35 -08:00
fwserial staging: fwserial: remove multiple blank lines 2014-11-26 13:53:25 -08:00
gdm72xx staging: gdm72xx: Remove useless cast on void pointer 2014-10-30 13:05:47 -07:00
gdm724x
goldfish
gs_fpgaboot staging: gs_fpgaboot: fix a compiler warning with make W=2 2014-10-29 17:39:55 +08:00
iio Merge 3.18-rc4 into staging-next 2014-11-10 12:24:26 +09:00
imx-drm staging: imx-drm: remove old FSF address from license text 2014-11-05 14:52:59 -08:00
line6
lustre staging: lustre: ldlm: Remove space before braces for defined() check 2014-11-26 12:51:29 -08:00
media staging: media: lirc: modify print calls 2014-11-05 14:49:14 -08:00
mt29f_spinand
netlogic
nvec
octeon staging: octeon-ethernet: drop multiple NAPI instances 2014-11-26 13:45:11 -08:00
octeon-usb staging: octeon-usb: eliminate cvmx_dprintf() usage 2014-11-26 13:45:12 -08:00
olpc_dcon staging: olpc_dcon: Deletion of a check before backlight_device_unregister() 2014-11-26 14:00:22 -08:00
ozwpan staging: ozwpan: Deletion of unnecessary checks before the function call "oz_free_urb_link" 2014-11-26 14:00:22 -08:00
panel staging: panel: Use better names for two defined values 2014-11-26 13:53:25 -08:00
rtl8188eu staging: rtl8188eu: hal: hal_intf.c: Cleaning up functions that are not used anywhere 2014-12-02 16:29:26 -08:00
rtl8192e staging: rtl8192e: add missing tasklet_kill on remove path 2014-11-26 14:03:06 -08:00
rtl8192u Staging: rtl8192u: Use put_unaligned_le16 2014-11-03 16:09:27 -08:00
rtl8712 staging: rtl8712: remove unused variables 2014-10-29 17:37:26 +08:00
rtl8723au staging:rtl8723au: fix sparse warning: incorrect type in assignment 2014-11-26 12:43:45 -08:00
rts5208 staging: rts5208: Remove useless cast on void pointer 2014-10-30 13:06:03 -07:00
skein staging: skein: fix sparse warnings related to shift operator 2014-11-22 10:53:09 -08:00
slicoss Staging: slicoss: Removed unnecessary parentheses 2014-10-28 15:58:17 +08:00
speakup
ste_rmi4
unisys staging: unisys: remove pointless macros 2014-11-27 08:13:24 -08:00
vme Staging: vme: devices: Use kasprintf 2014-10-27 10:33:05 +08:00
vt6655 staging: vt6655: rf.c clean up function comments 2014-11-26 13:37:24 -08:00
vt6656
wlan-ng staging: wlan-ng: prism2fw: fixed code style issue 2014-11-26 14:00:22 -08:00
xgifb staging: xgifb: Removed a definition which was not used in driver 2014-11-03 16:10:38 -08:00
Kconfig staging: bcm: remove driver 2014-10-20 10:30:15 +08:00
Makefile staging: bcm: remove driver 2014-10-20 10:30:15 +08:00
staging.c