[PATCH 3/3] staging: comedi: ni_mio_common: only do counter commands for ni_pcimio

H Hartley Sweeten hartleys at visionengravers.com
Fri May 10 16:43:36 UTC 2013


On Friday, May 10, 2013 6:07 AM, Ian Abbott wrote:
> "ni_mio_common.c" holds common code included by "ni_pcimio.c",
> "ni_atmio.c" and "ni_mio_cs.c", including a common initialization
> function `ni_E_init()`.  Amongst other things, this initializes some
> counter subdevices to support comedi instructions and asynchronous
> commands.  However, even though it sets up the handlers to support
> asynchronous commands on these subdevices, the handlers will return an
> error unless the `PCIDMA` macro is defined (which is defined only in
> "ni_pcimio.c").  If the `PCIDMA` macro is not defined, the comedi core
> will needlessly allocate buffers to support the asynchronous commands.
> Also, `s->async_dma_dir` is set to `DMA_BIDIRECTIONAL`, causing the
> physical pages for the buffers to be allocated using
> `dma_alloc_coherent()`.
>
> If the comedi core cannot call `dma_alloc_coherent()` because
> `CONFIG_HAS_DMA` is not defined, it will fail to allocate the buffers,
> which ultimately causes `ni_E_init()` to fail.
>
> Avoid the wastage and prevent the failure by only setting up
> asynchronous command support for the counter subdevices if the `PCIDMA`
> macro is defined.
>
> Signed-off-by: Ian Abbott <abbotti at mev.co.uk>
> ---
>  drivers/staging/comedi/drivers/ni_mio_common.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)

Ian,

Other than the minor comments on patches 1/3 and 2/3, I don't see any
issues with this series.

It should fix Geert Uytterhoeven's build problem and it keeps comedi from
globaly depending on HAS_DMA.

I plan on looking over the National drivers and cleaning up the complexity
caused by the mite, ni_tio, ni_tiocmd, and ni_mio_common modules. For
now this should work.

Thanks,

Reviewed-by: H Hartley Sweeten <hsweeten at visionengravers.com>




More information about the devel mailing list