mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
801661467f
commit
63f89caad0
|
@ -571,11 +571,15 @@ struct dma_chan *dma_get_any_slave_channel(struct dma_device *device)
|
||||||
|
|
||||||
chan = private_candidate(&mask, device, NULL, NULL);
|
chan = private_candidate(&mask, device, NULL, NULL);
|
||||||
if (chan) {
|
if (chan) {
|
||||||
|
dma_cap_set(DMA_PRIVATE, device->cap_mask);
|
||||||
|
device->privatecnt++;
|
||||||
err = dma_chan_get(chan);
|
err = dma_chan_get(chan);
|
||||||
if (err) {
|
if (err) {
|
||||||
pr_debug("%s: failed to get %s: (%d)\n",
|
pr_debug("%s: failed to get %s: (%d)\n",
|
||||||
__func__, dma_chan_name(chan), err);
|
__func__, dma_chan_name(chan), err);
|
||||||
chan = NULL;
|
chan = NULL;
|
||||||
|
if (--device->privatecnt == 0)
|
||||||
|
dma_cap_clear(DMA_PRIVATE, device->cap_mask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue