diff options
author | Felix Fietkau <nbd@openwrt.org> | 2015-08-07 08:36:16 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2015-08-07 08:36:16 +0000 |
commit | c7bf2accc94e081fab0c595c7e5ddd70cfe6b0c1 (patch) | |
tree | abfce27ffeaf84f9ec70582fbbb3ad3c889c49c3 /target/linux/ipq806x/patches-3.18/150-dmaengine-Rework-dma_chan_get.patch | |
parent | de19f06d12e9afd1278e46909bd973189235b2fa (diff) | |
download | mtk-20170518-c7bf2accc94e081fab0c595c7e5ddd70cfe6b0c1.zip mtk-20170518-c7bf2accc94e081fab0c595c7e5ddd70cfe6b0c1.tar.gz mtk-20170518-c7bf2accc94e081fab0c595c7e5ddd70cfe6b0c1.tar.bz2 |
ipq806x: Add ADM support
These are cherry-picked & backported from LKML:
*https://lkml.org/lkml/2015/3/17/19
They are enabled on both 3.18 and 4.1 kernel. Patches 150 to 154 are
applying changes merged since 3.18; they enable mechanisms used by the
ADM driver.
ADM engine is used by the NAND controller, so it is necessary to
bring-up NAND flash support.
Signed-off-by: Mathieu Olivari <mathieu@codeaurora.org>
SVN-Revision: 46567
Diffstat (limited to 'target/linux/ipq806x/patches-3.18/150-dmaengine-Rework-dma_chan_get.patch')
-rw-r--r-- | target/linux/ipq806x/patches-3.18/150-dmaengine-Rework-dma_chan_get.patch | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/target/linux/ipq806x/patches-3.18/150-dmaengine-Rework-dma_chan_get.patch b/target/linux/ipq806x/patches-3.18/150-dmaengine-Rework-dma_chan_get.patch new file mode 100644 index 0000000..880e67c --- /dev/null +++ b/target/linux/ipq806x/patches-3.18/150-dmaengine-Rework-dma_chan_get.patch @@ -0,0 +1,70 @@ +From d2f4f99db3e9ec8b063cf2e45704e2bb95428317 Mon Sep 17 00:00:00 2001 +From: Maxime Ripard <maxime.ripard@free-electrons.com> +Date: Mon, 17 Nov 2014 14:41:58 +0100 +Subject: [PATCH] dmaengine: Rework dma_chan_get + +dma_chan_get uses a rather interesting error handling and code path. + +Change it to something more usual in the kernel. + +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 | 36 +++++++++++++++++++----------------- + 1 file changed, 19 insertions(+), 17 deletions(-) + +--- a/drivers/dma/dmaengine.c ++++ b/drivers/dma/dmaengine.c +@@ -222,31 +222,33 @@ static void balance_ref_count(struct dma + */ + static int dma_chan_get(struct dma_chan *chan) + { +- int err = -ENODEV; + struct module *owner = dma_chan_to_owner(chan); ++ int ret; + ++ /* The channel is already in use, update client count */ + if (chan->client_count) { + __module_get(owner); +- err = 0; +- } else if (try_module_get(owner)) +- err = 0; ++ goto out; ++ } + +- if (err == 0) +- chan->client_count++; ++ if (!try_module_get(owner)) ++ return -ENODEV; + + /* allocate upon first client reference */ +- if (chan->client_count == 1 && err == 0) { +- int desc_cnt = chan->device->device_alloc_chan_resources(chan); +- +- if (desc_cnt < 0) { +- err = desc_cnt; +- chan->client_count = 0; +- module_put(owner); +- } else if (!dma_has_cap(DMA_PRIVATE, chan->device->cap_mask)) +- balance_ref_count(chan); +- } +- +- return err; ++ 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); ++ ++out: ++ chan->client_count++; ++ return 0; ++ ++err_out: ++ module_put(owner); ++ return ret; + } + + /** |