summaryrefslogtreecommitdiff
path: root/drivers/dma
diff options
context:
space:
mode:
authorVinod Koul <vinod.koul@intel.com>2013-08-14 08:25:04 (GMT)
committerVinod Koul <vinod.koul@intel.com>2013-08-14 08:25:04 (GMT)
commitaab81e47f58ea13f8bf7c1046670dd80566b1040 (patch)
treecc603805419d35a0412186136f503374712db72d /drivers/dma
parent52a9d179109c50b1a5077cc2a653295fa131f0d0 (diff)
parent7bb587f4eef8f71ce589f360ab99bb54ab0fc85d (diff)
downloadlinux-aab81e47f58ea13f8bf7c1046670dd80566b1040.tar.xz
Merge branch 'topic/of' into for-linus
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/dmaengine.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 9e56745..5932ab1 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -504,6 +504,32 @@ static struct dma_chan *private_candidate(const dma_cap_mask_t *mask,
}
/**
+ * dma_request_channel - try to get specific channel exclusively
+ * @chan: target channel
+ */
+struct dma_chan *dma_get_slave_channel(struct dma_chan *chan)
+{
+ int err = -EBUSY;
+
+ /* lock against __dma_request_channel */
+ mutex_lock(&dma_list_mutex);
+
+ if (chan->client_count == 0)
+ err = dma_chan_get(chan);
+ else
+ chan = NULL;
+
+ mutex_unlock(&dma_list_mutex);
+
+ if (err)
+ pr_debug("%s: failed to get %s: (%d)\n",
+ __func__, dma_chan_name(chan), err);
+
+ return chan;
+}
+EXPORT_SYMBOL_GPL(dma_get_slave_channel);
+
+/**
* dma_request_channel - try to allocate an exclusive channel
* @mask: capabilities that the channel must satisfy
* @fn: optional callback to disposition available channels