summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorChristopher Freeman <cfreeman@nvidia.com>2015-03-04 01:16:58 -0800
committerpopcornmix <popcornmix@gmail.com>2015-05-18 14:12:50 +0100
commitfe120f1eb52acddde33e12b03ebb16380f52fe51 (patch)
treed9a8f2665e84cd49da6f12d80e073c3c0532d7e0 /drivers
parent4d791a6422e2fdf2d25d6fb6d73277595f40c155 (diff)
downloadlinux-fe120f1eb52acddde33e12b03ebb16380f52fe51.tar.gz
dmaengine: increment privatecnt when using dma_get_any_slave_channel
Channels allocated via dma_get_any_slave_channel were not increasing the counter tracking private allocations. When these channels were released, privatecnt may erroneously fall to zero. The DMA device would then lose its DMA_PRIVATE cap and fail to allocate future private channels (via private_candidate) as any allocations still outstanding would incorrectly be seen as public allocations. Signed-off-by: Christopher Freeman <cfreeman@nvidia.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/dma/dmaengine.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index ac336a961dea..bb2b914dfec5 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -589,11 +589,15 @@ struct dma_chan *dma_get_any_slave_channel(struct dma_device *device)
chan = private_candidate(&mask, device, NULL, NULL);
if (chan) {
+ dma_cap_set(DMA_PRIVATE, device->cap_mask);
+ device->privatecnt++;
err = dma_chan_get(chan);
if (err) {
pr_debug("%s: failed to get %s: (%d)\n",
__func__, dma_chan_name(chan), err);
chan = NULL;
+ if (--device->privatecnt == 0)
+ dma_cap_clear(DMA_PRIVATE, device->cap_mask);
}
}