diff options
author | Christopher Freeman <cfreeman@nvidia.com> | 2015-03-04 04:16:58 -0500 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2015-04-29 07:17:57 -0400 |
commit | 63f89caad0e32dcfa17b2d17919816253de48996 (patch) | |
tree | 28329a099239bd98a4c53e3f153b5c53083247f9 /drivers/dma/dmaengine.c | |
parent | 801661467fd50832191c81665d061ffabcc1c5de (diff) |
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/dma/dmaengine.c')
-rw-r--r-- | drivers/dma/dmaengine.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index 0e035a8cf401..2890d744bb1b 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c | |||
@@ -571,11 +571,15 @@ struct dma_chan *dma_get_any_slave_channel(struct dma_device *device) | |||
571 | 571 | ||
572 | chan = private_candidate(&mask, device, NULL, NULL); | 572 | chan = private_candidate(&mask, device, NULL, NULL); |
573 | if (chan) { | 573 | if (chan) { |
574 | dma_cap_set(DMA_PRIVATE, device->cap_mask); | ||
575 | device->privatecnt++; | ||
574 | err = dma_chan_get(chan); | 576 | err = dma_chan_get(chan); |
575 | if (err) { | 577 | if (err) { |
576 | pr_debug("%s: failed to get %s: (%d)\n", | 578 | pr_debug("%s: failed to get %s: (%d)\n", |
577 | __func__, dma_chan_name(chan), err); | 579 | __func__, dma_chan_name(chan), err); |
578 | chan = NULL; | 580 | chan = NULL; |
581 | if (--device->privatecnt == 0) | ||
582 | dma_cap_clear(DMA_PRIVATE, device->cap_mask); | ||
579 | } | 583 | } |
580 | } | 584 | } |
581 | 585 | ||