summaryrefslogtreecommitdiff
path: root/target/linux/ipq806x/patches-3.18/152-dmaengine-Make-channel-allocation-callbacks-optional.patch
diff options
context:
space:
mode:
authorJohn Crispin <john@phrozen.org>2016-05-27 22:27:28 +0200
committerJohn Crispin <john@phrozen.org>2016-05-27 22:28:15 +0200
commit21802f22f06396189977f3e3b5a7103134352c15 (patch)
tree01b7852a1717725b3064060ea53f5ad093fb59ee /target/linux/ipq806x/patches-3.18/152-dmaengine-Make-channel-allocation-callbacks-optional.patch
parent2b4e5d478b90960e35719a0262e93b35e0338b3f (diff)
downloadmtk-20170518-21802f22f06396189977f3e3b5a7103134352c15.zip
mtk-20170518-21802f22f06396189977f3e3b5a7103134352c15.tar.gz
mtk-20170518-21802f22f06396189977f3e3b5a7103134352c15.tar.bz2
ipq806x: fix 3.18 support
accidentially removed the files in the v4.4 commit Signed-off-by: John Crispin <john@phrozen.org>
Diffstat (limited to 'target/linux/ipq806x/patches-3.18/152-dmaengine-Make-channel-allocation-callbacks-optional.patch')
-rw-r--r--target/linux/ipq806x/patches-3.18/152-dmaengine-Make-channel-allocation-callbacks-optional.patch62
1 files changed, 62 insertions, 0 deletions
diff --git a/target/linux/ipq806x/patches-3.18/152-dmaengine-Make-channel-allocation-callbacks-optional.patch b/target/linux/ipq806x/patches-3.18/152-dmaengine-Make-channel-allocation-callbacks-optional.patch
new file mode 100644
index 0000000..6337259
--- /dev/null
+++ b/target/linux/ipq806x/patches-3.18/152-dmaengine-Make-channel-allocation-callbacks-optional.patch
@@ -0,0 +1,62 @@
+From c4b54a648e682f678c338619df848233a6babc46 Mon Sep 17 00:00:00 2001
+From: Maxime Ripard <maxime.ripard@free-electrons.com>
+Date: Mon, 17 Nov 2014 14:41:59 +0100
+Subject: [PATCH] dmaengine: Make channel allocation callbacks optional
+
+Nowadays, some drivers don't have anything in there channel allocation
+callbacks anymore.
+
+Remove the BUG_ON if those callbacks aren't implemented, in order to allow
+drivers to not implement them.
+
+Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Vinod Koul <vinod.koul@intel.com>
+---
+ drivers/dma/dmaengine.c | 18 +++++++++++-------
+ 1 file changed, 11 insertions(+), 7 deletions(-)
+
+--- a/drivers/dma/dmaengine.c
++++ b/drivers/dma/dmaengine.c
+@@ -235,9 +235,11 @@ static int dma_chan_get(struct dma_chan
+ return -ENODEV;
+
+ /* allocate upon first client reference */
+- ret = chan->device->device_alloc_chan_resources(chan);
+- if (ret < 0)
+- goto err_out;
++ if (chan->device->device_alloc_chan_resources) {
++ ret = chan->device->device_alloc_chan_resources(chan);
++ if (ret < 0)
++ goto err_out;
++ }
+
+ if (!dma_has_cap(DMA_PRIVATE, chan->device->cap_mask))
+ balance_ref_count(chan);
+@@ -259,11 +261,15 @@ err_out:
+ */
+ static void dma_chan_put(struct dma_chan *chan)
+ {
++ /* This channel is not in use, bail out */
+ if (!chan->client_count)
+- return; /* this channel failed alloc_chan_resources */
++ return;
++
+ chan->client_count--;
+ module_put(dma_chan_to_owner(chan));
+- if (chan->client_count == 0)
++
++ /* This channel is not in use anymore, free it */
++ if (!chan->client_count && chan->device->device_free_chan_resources)
+ chan->device->device_free_chan_resources(chan);
+ }
+
+@@ -817,8 +823,6 @@ int dma_async_device_register(struct dma
+ BUG_ON(dma_has_cap(DMA_INTERLEAVE, device->cap_mask) &&
+ !device->device_prep_interleaved_dma);
+
+- BUG_ON(!device->device_alloc_chan_resources);
+- BUG_ON(!device->device_free_chan_resources);
+ BUG_ON(!device->device_tx_status);
+ BUG_ON(!device->device_issue_pending);
+ BUG_ON(!device->dev);