diff options
Diffstat (limited to 'drivers/dma/mmp_pdma.c')
-rw-r--r-- | drivers/dma/mmp_pdma.c | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c index dcb1e05149a7..2998f1bffac1 100644 --- a/drivers/dma/mmp_pdma.c +++ b/drivers/dma/mmp_pdma.c | |||
@@ -893,33 +893,17 @@ static struct dma_chan *mmp_pdma_dma_xlate(struct of_phandle_args *dma_spec, | |||
893 | struct of_dma *ofdma) | 893 | struct of_dma *ofdma) |
894 | { | 894 | { |
895 | struct mmp_pdma_device *d = ofdma->of_dma_data; | 895 | struct mmp_pdma_device *d = ofdma->of_dma_data; |
896 | struct dma_chan *chan, *candidate; | 896 | struct dma_chan *chan; |
897 | struct mmp_pdma_chan *c; | ||
897 | 898 | ||
898 | retry: | 899 | chan = dma_get_any_slave_channel(&d->device); |
899 | candidate = NULL; | 900 | if (!chan) |
900 | |||
901 | /* walk the list of channels registered with the current instance and | ||
902 | * find one that is currently unused */ | ||
903 | list_for_each_entry(chan, &d->device.channels, device_node) | ||
904 | if (chan->client_count == 0) { | ||
905 | candidate = chan; | ||
906 | break; | ||
907 | } | ||
908 | |||
909 | if (!candidate) | ||
910 | return NULL; | 901 | return NULL; |
911 | 902 | ||
912 | /* dma_get_slave_channel will return NULL if we lost a race between | 903 | c = to_mmp_pdma_chan(chan); |
913 | * the lookup and the reservation */ | 904 | c->drcmr = dma_spec->args[0]; |
914 | chan = dma_get_slave_channel(candidate); | ||
915 | |||
916 | if (chan) { | ||
917 | struct mmp_pdma_chan *c = to_mmp_pdma_chan(chan); | ||
918 | c->drcmr = dma_spec->args[0]; | ||
919 | return chan; | ||
920 | } | ||
921 | 905 | ||
922 | goto retry; | 906 | return chan; |
923 | } | 907 | } |
924 | 908 | ||
925 | static int mmp_pdma_probe(struct platform_device *op) | 909 | static int mmp_pdma_probe(struct platform_device *op) |