1
0
Fork 0

staging: comedi: ni_labpc_isadma: add labpc_have_dma_chan()

Add a static inline function to "ni_labpc_isadma.h" to test if a DMA
channel has been set-up, in which case `devpriv->dma_chan` will be
non-zero (where `devpriv` point to the private data for the comedi
device).  If the "ni_labpc_isadma" module is not being built, don't
bother checking `devpriv->dma_chan`; just return `false` as this may
help the compiler to optimize out some unreachable code.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
hifive-unleashed-5.1
Ian Abbott 2013-06-28 17:09:21 +01:00 committed by Greg Kroah-Hartman
parent 86aff4bb11
commit c6208c2f35
1 changed files with 12 additions and 0 deletions

View File

@ -9,11 +9,23 @@
#if NI_LABPC_HAVE_ISA_DMA
static inline bool labpc_have_dma_chan(struct comedi_device *dev)
{
struct labpc_private *devpriv = dev->private;
return (bool)devpriv->dma_chan;
}
int labpc_init_dma_chan(struct comedi_device *dev, unsigned int dma_chan);
void labpc_free_dma_chan(struct comedi_device *dev);
#else
static inline bool labpc_have_dma_chan(struct comedi_device *dev)
{
return false;
}
static inline int labpc_init_dma_chan(struct comedi_device *dev,
unsigned int dma_chan)
{