Commit 098de42a authored by Tony Lindgren's avatar Tony Lindgren Committed by Vinod Koul

dmaengine: cppi41: Fix unpaired pm runtime when only a USB hub is connected

On am335x with musb host we can end up with unpaired pm runtime calls
if a hub with no devices is connected and disconnected.

This is because of the conditional pm runtime calls which are always
a bad idea. Let's fix the issue by making them unconditional and
paired in each function.

Fixes: fdea2d09 ("dmaengine: cppi41: Add basic PM runtime support")
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
parent 12f59080
...@@ -318,6 +318,11 @@ static irqreturn_t cppi41_irq(int irq, void *data) ...@@ -318,6 +318,11 @@ static irqreturn_t cppi41_irq(int irq, void *data)
while (val) { while (val) {
u32 desc, len; u32 desc, len;
status = pm_runtime_get(cdd->ddev.dev);
if (status < 0)
dev_err(cdd->ddev.dev, "%s pm runtime get: %i\n",
__func__, status);
q_num = __fls(val); q_num = __fls(val);
val &= ~(1 << q_num); val &= ~(1 << q_num);
q_num += 32 * i; q_num += 32 * i;
...@@ -338,7 +343,6 @@ static irqreturn_t cppi41_irq(int irq, void *data) ...@@ -338,7 +343,6 @@ static irqreturn_t cppi41_irq(int irq, void *data)
dma_cookie_complete(&c->txd); dma_cookie_complete(&c->txd);
dmaengine_desc_get_callback_invoke(&c->txd, NULL); dmaengine_desc_get_callback_invoke(&c->txd, NULL);
/* Paired with cppi41_dma_issue_pending */
pm_runtime_mark_last_busy(cdd->ddev.dev); pm_runtime_mark_last_busy(cdd->ddev.dev);
pm_runtime_put_autosuspend(cdd->ddev.dev); pm_runtime_put_autosuspend(cdd->ddev.dev);
} }
...@@ -460,7 +464,6 @@ static void cppi41_dma_issue_pending(struct dma_chan *chan) ...@@ -460,7 +464,6 @@ static void cppi41_dma_issue_pending(struct dma_chan *chan)
struct cppi41_dd *cdd = c->cdd; struct cppi41_dd *cdd = c->cdd;
int error; int error;
/* PM runtime paired with dmaengine_desc_get_callback_invoke */
error = pm_runtime_get(cdd->ddev.dev); error = pm_runtime_get(cdd->ddev.dev);
if ((error != -EINPROGRESS) && error < 0) { if ((error != -EINPROGRESS) && error < 0) {
dev_err(cdd->ddev.dev, "Failed to pm_runtime_get: %i\n", dev_err(cdd->ddev.dev, "Failed to pm_runtime_get: %i\n",
...@@ -473,6 +476,9 @@ static void cppi41_dma_issue_pending(struct dma_chan *chan) ...@@ -473,6 +476,9 @@ static void cppi41_dma_issue_pending(struct dma_chan *chan)
push_desc_queue(c); push_desc_queue(c);
else else
pending_desc(c); pending_desc(c);
pm_runtime_mark_last_busy(cdd->ddev.dev);
pm_runtime_put_autosuspend(cdd->ddev.dev);
} }
static u32 get_host_pd0(u32 length) static u32 get_host_pd0(u32 length)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment