diff options
author | Vinod Koul <vinod.koul@intel.com> | 2014-01-07 11:06:24 -0500 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2014-01-07 11:06:24 -0500 |
commit | 0adcdeed6f87ac7230c9a0364ac785b8e70ad275 (patch) | |
tree | 77fd04c067b024887d801778227501762bdf2ddd | |
parent | 4fce628f685945df4fd6fa1cab6f7eb397dc9267 (diff) | |
parent | 8010dad55a0ab0e829f3733854e5235eef4e2734 (diff) |
Merge branch 'topic/of' into for-linus
Conflicts:
drivers/dma/mmp_pdma.c
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r-- | drivers/dma/dmaengine.c | 28 | ||||
-rw-r--r-- | drivers/dma/mmp_pdma.c | 17 | ||||
-rw-r--r-- | include/linux/dmaengine.h | 1 |
3 files changed, 33 insertions, 13 deletions
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index e17e9b22d85e..24095ff8a93b 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c | |||
@@ -535,6 +535,34 @@ struct dma_chan *dma_get_slave_channel(struct dma_chan *chan) | |||
535 | } | 535 | } |
536 | EXPORT_SYMBOL_GPL(dma_get_slave_channel); | 536 | EXPORT_SYMBOL_GPL(dma_get_slave_channel); |
537 | 537 | ||
538 | struct dma_chan *dma_get_any_slave_channel(struct dma_device *device) | ||
539 | { | ||
540 | dma_cap_mask_t mask; | ||
541 | struct dma_chan *chan; | ||
542 | int err; | ||
543 | |||
544 | dma_cap_zero(mask); | ||
545 | dma_cap_set(DMA_SLAVE, mask); | ||
546 | |||
547 | /* lock against __dma_request_channel */ | ||
548 | mutex_lock(&dma_list_mutex); | ||
549 | |||
550 | chan = private_candidate(&mask, device, NULL, NULL); | ||
551 | if (chan) { | ||
552 | err = dma_chan_get(chan); | ||
553 | if (err) { | ||
554 | pr_debug("%s: failed to get %s: (%d)\n", | ||
555 | __func__, dma_chan_name(chan), err); | ||
556 | chan = NULL; | ||
557 | } | ||
558 | } | ||
559 | |||
560 | mutex_unlock(&dma_list_mutex); | ||
561 | |||
562 | return chan; | ||
563 | } | ||
564 | EXPORT_SYMBOL_GPL(dma_get_any_slave_channel); | ||
565 | |||
538 | /** | 566 | /** |
539 | * __dma_request_channel - try to allocate an exclusive channel | 567 | * __dma_request_channel - try to allocate an exclusive channel |
540 | * @mask: capabilities that the channel must satisfy | 568 | * @mask: capabilities that the channel must satisfy |
diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c index 3f7712c4d3fa..c1b7c3ac7676 100644 --- a/drivers/dma/mmp_pdma.c +++ b/drivers/dma/mmp_pdma.c | |||
@@ -898,20 +898,11 @@ static struct dma_chan *mmp_pdma_dma_xlate(struct of_phandle_args *dma_spec, | |||
898 | struct of_dma *ofdma) | 898 | struct of_dma *ofdma) |
899 | { | 899 | { |
900 | struct mmp_pdma_device *d = ofdma->of_dma_data; | 900 | struct mmp_pdma_device *d = ofdma->of_dma_data; |
901 | struct dma_chan *chan, *candidate; | 901 | struct dma_chan *chan; |
902 | struct mmp_pdma_chan *c; | ||
902 | 903 | ||
903 | retry: | 904 | chan = dma_get_any_slave_channel(&d->device); |
904 | candidate = NULL; | 905 | if (!chan) |
905 | |||
906 | /* walk the list of channels registered with the current instance and | ||
907 | * find one that is currently unused */ | ||
908 | list_for_each_entry(chan, &d->device.channels, device_node) | ||
909 | if (chan->client_count == 0) { | ||
910 | candidate = chan; | ||
911 | break; | ||
912 | } | ||
913 | |||
914 | if (!candidate) | ||
915 | return NULL; | 906 | return NULL; |
916 | 907 | ||
917 | /* dma_get_slave_channel will return NULL if we lost a race between | 908 | /* dma_get_slave_channel will return NULL if we lost a race between |
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index de550c61ba43..fa6b4285d8d2 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
@@ -1086,6 +1086,7 @@ int dma_async_device_register(struct dma_device *device); | |||
1086 | void dma_async_device_unregister(struct dma_device *device); | 1086 | void dma_async_device_unregister(struct dma_device *device); |
1087 | void dma_run_dependencies(struct dma_async_tx_descriptor *tx); | 1087 | void dma_run_dependencies(struct dma_async_tx_descriptor *tx); |
1088 | struct dma_chan *dma_get_slave_channel(struct dma_chan *chan); | 1088 | struct dma_chan *dma_get_slave_channel(struct dma_chan *chan); |
1089 | struct dma_chan *dma_get_any_slave_channel(struct dma_device *device); | ||
1089 | struct dma_chan *net_dma_find_channel(void); | 1090 | struct dma_chan *net_dma_find_channel(void); |
1090 | #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) | 1091 | #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) |
1091 | #define dma_request_slave_channel_compat(mask, x, y, dev, name) \ | 1092 | #define dma_request_slave_channel_compat(mask, x, y, dev, name) \ |