diff options
author | Vinod Koul <vinod.koul@intel.com> | 2013-08-14 04:25:04 -0400 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2013-08-14 04:25:04 -0400 |
commit | aab81e47f58ea13f8bf7c1046670dd80566b1040 (patch) | |
tree | cc603805419d35a0412186136f503374712db72d | |
parent | 52a9d179109c50b1a5077cc2a653295fa131f0d0 (diff) | |
parent | 7bb587f4eef8f71ce589f360ab99bb54ab0fc85d (diff) |
Merge branch 'topic/of' into for-linus
-rw-r--r-- | drivers/dma/dmaengine.c | 26 | ||||
-rw-r--r-- | include/linux/dmaengine.h | 1 |
2 files changed, 27 insertions, 0 deletions
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index 9e56745f87bf..5932ab164ace 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, | |||
504 | } | 504 | } |
505 | 505 | ||
506 | /** | 506 | /** |
507 | * dma_request_channel - try to get specific channel exclusively | ||
508 | * @chan: target channel | ||
509 | */ | ||
510 | struct dma_chan *dma_get_slave_channel(struct dma_chan *chan) | ||
511 | { | ||
512 | int err = -EBUSY; | ||
513 | |||
514 | /* lock against __dma_request_channel */ | ||
515 | mutex_lock(&dma_list_mutex); | ||
516 | |||
517 | if (chan->client_count == 0) | ||
518 | err = dma_chan_get(chan); | ||
519 | else | ||
520 | chan = NULL; | ||
521 | |||
522 | mutex_unlock(&dma_list_mutex); | ||
523 | |||
524 | if (err) | ||
525 | pr_debug("%s: failed to get %s: (%d)\n", | ||
526 | __func__, dma_chan_name(chan), err); | ||
527 | |||
528 | return chan; | ||
529 | } | ||
530 | EXPORT_SYMBOL_GPL(dma_get_slave_channel); | ||
531 | |||
532 | /** | ||
507 | * dma_request_channel - try to allocate an exclusive channel | 533 | * dma_request_channel - try to allocate an exclusive channel |
508 | * @mask: capabilities that the channel must satisfy | 534 | * @mask: capabilities that the channel must satisfy |
509 | * @fn: optional callback to disposition available channels | 535 | * @fn: optional callback to disposition available channels |
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index cb286b1acdb6..c271608e862e 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
@@ -995,6 +995,7 @@ int dma_async_device_register(struct dma_device *device); | |||
995 | void dma_async_device_unregister(struct dma_device *device); | 995 | void dma_async_device_unregister(struct dma_device *device); |
996 | void dma_run_dependencies(struct dma_async_tx_descriptor *tx); | 996 | void dma_run_dependencies(struct dma_async_tx_descriptor *tx); |
997 | struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type); | 997 | struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type); |
998 | struct dma_chan *dma_get_slave_channel(struct dma_chan *chan); | ||
998 | struct dma_chan *net_dma_find_channel(void); | 999 | struct dma_chan *net_dma_find_channel(void); |
999 | #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) | 1000 | #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) |
1000 | #define dma_request_slave_channel_compat(mask, x, y, dev, name) \ | 1001 | #define dma_request_slave_channel_compat(mask, x, y, dev, name) \ |