aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/ti/cppi41.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2019-11-02 13:12:51 -0700
committerDavid S. Miller <davem@davemloft.net>2019-11-02 13:54:56 -0700
commitd31e95585ca697fb31440c6fe30113adc85ecfbd (patch)
tree4936ea0aaa6b2aeeee4db51e3c60d938c9b9ed96 /drivers/dma/ti/cppi41.c
parenttc-testing: added tests with cookie for conntrack TC action (diff)
parentMerge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net (diff)
downloadlinux-dev-d31e95585ca697fb31440c6fe30113adc85ecfbd.tar.xz
linux-dev-d31e95585ca697fb31440c6fe30113adc85ecfbd.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
The only slightly tricky merge conflict was the netdevsim because the mutex locking fix overlapped a lot of driver reload reorganization. The rest were (relatively) trivial in nature. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/dma/ti/cppi41.c')
-rw-r--r--drivers/dma/ti/cppi41.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/dma/ti/cppi41.c b/drivers/dma/ti/cppi41.c
index 2f946f55076c..8c2f7ebe998c 100644
--- a/drivers/dma/ti/cppi41.c
+++ b/drivers/dma/ti/cppi41.c
@@ -586,9 +586,22 @@ static struct dma_async_tx_descriptor *cppi41_dma_prep_slave_sg(
enum dma_transfer_direction dir, unsigned long tx_flags, void *context)
{
struct cppi41_channel *c = to_cpp41_chan(chan);
+ struct dma_async_tx_descriptor *txd = NULL;
+ struct cppi41_dd *cdd = c->cdd;
struct cppi41_desc *d;
struct scatterlist *sg;
unsigned int i;
+ int error;
+
+ error = pm_runtime_get(cdd->ddev.dev);
+ if (error < 0) {
+ pm_runtime_put_noidle(cdd->ddev.dev);
+
+ return NULL;
+ }
+
+ if (cdd->is_suspended)
+ goto err_out_not_ready;
d = c->desc;
for_each_sg(sgl, sg, sg_len, i) {
@@ -611,7 +624,13 @@ static struct dma_async_tx_descriptor *cppi41_dma_prep_slave_sg(
d++;
}
- return &c->txd;
+ txd = &c->txd;
+
+err_out_not_ready:
+ pm_runtime_mark_last_busy(cdd->ddev.dev);
+ pm_runtime_put_autosuspend(cdd->ddev.dev);
+
+ return txd;
}
static void cppi41_compute_td_desc(struct cppi41_desc *d)