staging: comedi: pcl818: fix (*cancel) when cmd->stop_src == TRIG_NONE
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 4 Mar 2014 18:29:45 +0000 (11:29 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Mar 2014 01:06:13 +0000 (17:06 -0800)
commit905a83211825d11716192043527ed7f84b0572a7
treecbf1adf7f3511abd605f7685869359aba0c591e6
parentedf0f32bafd92afaffca4f086be2a49ad526dfd3
staging: comedi: pcl818: fix (*cancel) when cmd->stop_src == TRIG_NONE

When using DMA, the async command (*cancel) operation is delayed until the
current DMA transfer is complete. When the DMA transfer finishes the interrupt
routine detects this and calls the (*cancel) again which should then cancel the
async command.

The current logic does not work when cmd->stop_src == TRIG_NONE. In this case
the (*cancel) function keeps delaying the cancel. The actual DMA does stop
because the DMA handler is not called to setup the next transfer but the
(*cancel) code is never executed.

Rename the 'irq_was_now_closed' flag in the private data to 'ai_cmd_canceled'
to clarify what it is.

Only set the flag in the (*cancel) when a DMA transfer is running and the
async command has not already been canceled. The interrupt routine then does
not need all the extra checks.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/pcl818.c