]> git.baikalelectronics.ru Git - kernel.git/commit
dmaengine: pxa_dma: fix residue corner case
authorRobert Jarzmik <robert.jarzmik@free.fr>
Wed, 30 Sep 2015 17:42:15 +0000 (19:42 +0200)
committerVinod Koul <vinod.koul@intel.com>
Thu, 1 Oct 2015 02:14:31 +0000 (07:44 +0530)
commit0264e0878b33e9c350fabed07780318c98f6f263
treef9681f78e175c16b76ffcab80daac533aa6b5be6
parent5a29afa1f059f214a6a54485140612a7fb5dcc8f
dmaengine: pxa_dma: fix residue corner case

A very tiny temporal window exists in the residue calculation where :
 - upon entering residue calculation, the transfer is ongoing
 - when reading the current transfer pointer, it just changed to
   the "finisher/linker" descriptor

In this case, the residue returned is the whole transfer length instead
of 0. Fix it.

This appears almost in one extreme case, where the driver is used
by older clients which inquire for residue in interrupt context, such
as the smsc91x ethernet driver, in a tight loop :
  interrupt_handler()
    dmaengine_submit()
    do {
      dmaengine_tx_status()
    } while (residue > 0 || status != DMA_ERROR)

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/pxa_dma.c