staging: comedi: work without HAS_DMA

The core "comedi" module and the "mite" helper module for NI PCI devices
both have calls to `dma_alloc_coherent()` and `dma_free_coherent()`.
Those functions are only available if `CONFIG_HAS_DMA` is defined.

Apart from the "mite" module, the functions are only called for comedi
drivers that set `s->async_dma_dir` (where `s` is a pointer to a `struct
comedi_subdevice`) to anything other than `DMA_NONE`.

Change local helper functions `__comedi_buf_alloc()` and
`__comedi_buf_free()` to only call `dma_alloc_coherent()` and
`dma_free_coherent()` if `CONFIG_HAS_DMA` is defined.

Change the "Kconfig" to make the following configuration options depend
on `HAS_DMA`:

`COMEDI_MITE` - builds the "mite" module.
`COMEDI_NI_6527` - selects `COMEDI_MITE`.
`COMEDI_NI_65XX` - selects `COMEDI_MITE`.
`COMEDI_NI_670X` - selects `COMEDI_MITE`.
`COMEDI_NI_LABPC_PCI` - selects `COMEDI_MITE`.
`COMEDI_NI_PCIDIO` - selects `COMEDI_MITE`.
`COMEDI_NI_TIOCMD` - selects `COMEDI_MITE`.
`COMEDI_NI_660X` - selects `COMEDI_NI_TIOCMD`,
                   sets `s->async_dma_dir`.
`COMEDI_NI_PCIMIO` - selects `COMEDI_NI_TIOCMD`,
                     sets `s->async_dma_dir`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 files changed