linux-sg2042/drivers/dma
Russell King - ARM Linux 2a926e4602 dmaengine: fix cookie handling in iop-adma.c and ppc4xx/adma.c
Dan Williams said:
> > Russell King wrote:
> > Firstly, we have DMA_MIN_COOKIE which has value 1 - so any cookies below
> > that aren't valid.  That seems sane.
> >
> > We seem to have different behaviours:
> >
> > -       cookie = c->cookie;
> > -       cookie++;
> > -       if (cookie < 0)
> > -               cookie = 1;
> > -       c->cookie = cookie;
> > -       tx->cookie = cookie;
> >
> > c->cookie here is initialized to zero, so the first cookie given out will
> > be 1.  This is how most DMA engine drivers implement this.
> >
> > Then we have this:
> >
> >                cookie = chan->common.cookie;
> >                cookie++;
> >                if (cookie <= 1)
> >                        cookie = 2;
> >
> >                /* initialize the completed cookie to be less than
> >                 * the most recently used cookie
> >                 */
> >                chan->common.completed_cookie = cookie - 1;
> >                chan->common.cookie = sw_desc->async_tx.cookie = cookie;
> >
> > Again, chan->common.cookie starts off at 0.  The first cookie given out
> > will be 2, and 1 will never be used.  There are three drivers which
> > implement it this way.
> >
> > Why is there this difference, and can these three be corrected to behave
> > the same way as the first (and therefore the assignment of cookies
> > consolidated?)
>
> Yes, they should be consolidated, and I believe they have drifted only
> because there were no good common helpers and murphy's law took over.

So lets fix this up to use the common dma_cookie_assign() helper.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Jassi Brar <jassisinghbrar@gmail.com>
[imx-sdma.c & mxs-dma.c]
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
2012-03-13 11:37:33 +05:30
..
ioat dmaengine: consolidate tx_status functions 2012-03-13 11:37:14 +05:30
ipu dmaengine: consolidate initialization of cookies 2012-03-13 11:37:22 +05:30
ppc4xx dmaengine: fix cookie handling in iop-adma.c and ppc4xx/adma.c 2012-03-13 11:37:33 +05:30
Kconfig dma: MX3_IPU fix depends 2011-12-19 12:26:07 +01:00
Makefile dmaengine: add CSR SiRFprimaII DMAC driver 2011-11-18 12:25:22 +05:30
TODO dmaengine: remove ste_dma40 from issue_pending TODO 2011-07-14 04:02:08 +05:30
amba-pl08x.c dmaengine: consolidate initialization of cookies 2012-03-13 11:37:22 +05:30
at_hdmac.c dmaengine: consolidate initialization of cookies 2012-03-13 11:37:22 +05:30
at_hdmac_regs.h dmaengine: move last completed cookie into generic dma_chan structure 2012-03-13 11:36:06 +05:30
coh901318.c dmaengine: consolidate initialization of cookies 2012-03-13 11:37:22 +05:30
coh901318_lli.c dmaengine: move drivers to dma_transfer_direction 2011-10-27 20:53:43 +05:30
coh901318_lli.h dmaengine: move drivers to dma_transfer_direction 2011-10-27 20:53:43 +05:30
dmaengine.c DMAEngine: Define interleaved transfer request api 2011-11-18 12:16:24 +05:30
dmaengine.h dmaengine: consolidate initialization of cookies 2012-03-13 11:37:22 +05:30
dmatest.c dmaengine: fix missing 'cnt' in ?: in dmatest 2012-01-23 11:43:18 -08:00
dw_dmac.c dmaengine: consolidate initialization of cookies 2012-03-13 11:37:22 +05:30
dw_dmac_regs.h dmaengine: move last completed cookie into generic dma_chan structure 2012-03-13 11:36:06 +05:30
ep93xx_dma.c dmaengine: consolidate initialization of cookies 2012-03-13 11:37:22 +05:30
fsldma.c dmaengine: consolidate tx_status functions 2012-03-13 11:37:14 +05:30
fsldma.h dmaengine: move last completed cookie into generic dma_chan structure 2012-03-13 11:36:06 +05:30
imx-dma.c dmaengine: consolidate tx_status functions 2012-03-13 11:37:14 +05:30
imx-sdma.c dmaengine: provide a common function for completing a dma descriptor 2012-03-13 11:37:01 +05:30
intel_mid_dma.c dmaengine: consolidate initialization of cookies 2012-03-13 11:37:22 +05:30
intel_mid_dma_regs.h dmaengine: move last completed cookie into generic dma_chan structure 2012-03-13 11:36:06 +05:30
iop-adma.c dmaengine: fix cookie handling in iop-adma.c and ppc4xx/adma.c 2012-03-13 11:37:33 +05:30
iovlock.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
mpc512x_dma.c dmaengine: consolidate initialization of cookies 2012-03-13 11:37:22 +05:30
mv_xor.c dmaengine: consolidate tx_status functions 2012-03-13 11:37:14 +05:30
mv_xor.h dmaengine: move last completed cookie into generic dma_chan structure 2012-03-13 11:36:06 +05:30
mxs-dma.c dmaengine: provide a common function for completing a dma descriptor 2012-03-13 11:37:01 +05:30
pch_dma.c dmaengine: consolidate initialization of cookies 2012-03-13 11:37:22 +05:30
pl330.c dmaengine: consolidate initialization of cookies 2012-03-13 11:37:22 +05:30
shdma.c dmaengine: consolidate tx_status functions 2012-03-13 11:37:14 +05:30
shdma.h dmaengine: move last completed cookie into generic dma_chan structure 2012-03-13 11:36:06 +05:30
sirf-dma.c dmaengine: consolidate initialization of cookies 2012-03-13 11:37:22 +05:30
ste_dma40.c dmaengine: consolidate initialization of cookies 2012-03-13 11:37:22 +05:30
ste_dma40_ll.c dma40: cyclic xfer support 2011-01-30 22:27:21 -08:00
ste_dma40_ll.h dmaengine/ste_dma40: support pm in dma40 2011-11-22 09:46:06 +05:30
timb_dma.c dmaengine: consolidate initialization of cookies 2012-03-13 11:37:22 +05:30
txx9dmac.c dmaengine: consolidate initialization of cookies 2012-03-13 11:37:22 +05:30
txx9dmac.h dmaengine: move last completed cookie into generic dma_chan structure 2012-03-13 11:36:06 +05:30