From: Xiang Wang <wangxfdu@gmail.com>
To: Vinod Koul <vinod.koul@intel.com>,
Dan Williams <dan.j.williams@intel.com>,
<dmaengine@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<cxie4@marvell.com>, <wangxfdu@gmail.com>
Cc: Xiang Wang <wangx@marvell.com>
Subject: [PATCH] dmaengine: increase privatecnt in dma_get_any_slave_channel
Date: Thu, 21 Aug 2014 19:01:21 +0800 [thread overview]
Message-ID: <1408618881-30279-1-git-send-email-wangxfdu@gmail.com> (raw)
From: Xiang Wang <wangx@marvell.com>
There might be such calling sequence for dma channel:
1. register dma device
dma_async_device_register
-> if (dma_has_cap(DMA_PRIVATE, device->cap_mask))
device->privatecnt++;
2. request channel
dma_request_slave_channel
-> of_dma_request_slave_channel
-> of_dma_xlate
-> dma_get_any_slave_channel in dma drivers
note that device->privatecnt is not changed during this.
3. release channel
dma_release_channel
-> if (--chan->device->privatecnt == 0)
dma_cap_clear(DMA_PRIVATE,
chan->device->cap_mask);
So if we request a channel then release it, DMA_PRIVATE will
be cleared unexpectedly. In this patch, we increase privatecnt
in step 2 just like what __dma_request_channel does.
Signed-off-by: Xiang Wang <wangx@marvell.com>
---
drivers/dma/dmaengine.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index ed610b4..01bb372 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -557,6 +557,9 @@ struct dma_chan *dma_get_any_slave_channel(struct dma_device *device)
}
}
+ if (chan && dma_has_cap(DMA_PRIVATE, device->cap_mask))
+ device->privatecnt++;
+
mutex_unlock(&dma_list_mutex);
return chan;
--
1.7.5.4
reply other threads:[~2014-08-21 11:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1408618881-30279-1-git-send-email-wangxfdu@gmail.com \
--to=wangxfdu@gmail.com \
--cc=cxie4@marvell.com \
--cc=dan.j.williams@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vinod.koul@intel.com \
--cc=wangx@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).