2a926e4602
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> |
||
---|---|---|
.. | ||
ioat | ||
ipu | ||
ppc4xx | ||
amba-pl08x.c | ||
at_hdmac.c | ||
at_hdmac_regs.h | ||
coh901318.c | ||
coh901318_lli.c | ||
coh901318_lli.h | ||
dmaengine.c | ||
dmaengine.h | ||
dmatest.c | ||
dw_dmac.c | ||
dw_dmac_regs.h | ||
ep93xx_dma.c | ||
fsldma.c | ||
fsldma.h | ||
imx-dma.c | ||
imx-sdma.c | ||
intel_mid_dma.c | ||
intel_mid_dma_regs.h | ||
iop-adma.c | ||
iovlock.c | ||
Kconfig | ||
Makefile | ||
mpc512x_dma.c | ||
mv_xor.c | ||
mv_xor.h | ||
mxs-dma.c | ||
pch_dma.c | ||
pl330.c | ||
shdma.c | ||
shdma.h | ||
sirf-dma.c | ||
ste_dma40.c | ||
ste_dma40_ll.c | ||
ste_dma40_ll.h | ||
timb_dma.c | ||
TODO | ||
txx9dmac.c | ||
txx9dmac.h |