History

dmaengine: qcom: bam_dma: fix runtime PM underflow

Commit dbad41e7bb5f ("dmaengine: qcom: bam_dma: check if the runtime pm enabled") caused unbalanced pm_runtime_get/put() calls when the bam is controlled remotely. This commit reverts it and just enables pm_runtime in all cases, the clk_* functions already just nop when the clock is NULL. Also clean up a bit by removing unnecessary bamclk null checks.

Caleb Connolly committed 4 years ago

Commit 0ac9c3d1 parent a7cd3cf1 file · +11 −28Browse files

Unified · Split

drivers/dma/qcom/bam_dma.c+11−28
@@ -558,14 +558,6 @@ static int bam_alloc_chan(struct dma_chan *chan) · 557 unmodified lines
558558 return 0;
559559 }
560560
561−static int bam_pm_runtime_get_sync(struct device *dev)
562−{
563− if (pm_runtime_enabled(dev))
564− return pm_runtime_get_sync(dev);
565−
566− return 0;
567−}
568−
569561 /**
570562 * bam_free_chan - Frees dma resources associated with specific channel
571563 * @chan: specified channel
@@ -581,7 +573,7 @@ static void bam_free_chan(struct dma_chan *chan) · 9 unmodified lines
581573 unsigned long flags;
582574 int ret;
583575
584− ret = bam_pm_runtime_get_sync(bdev->dev);
576+ ret = pm_runtime_get_sync(bdev->dev);
585577 if (ret < 0)
586578 return;
587579
@@ -784,7 +776,7 @@ static int bam_pause(struct dma_chan *chan) · 196 unmodified lines
784776 unsigned long flag;
785777 int ret;
786778
787− ret = bam_pm_runtime_get_sync(bdev->dev);
779+ ret = pm_runtime_get_sync(bdev->dev);
788780 if (ret < 0)
789781 return ret;
790782
@@ -810,7 +802,7 @@ static int bam_resume(struct dma_chan *chan) · 19 unmodified lines
810802 unsigned long flag;
811803 int ret;
812804
813− ret = bam_pm_runtime_get_sync(bdev->dev);
805+ ret = pm_runtime_get_sync(bdev->dev);
814806 if (ret < 0)
815807 return ret;
816808
@@ -919,7 +911,7 @@ static irqreturn_t bam_dma_irq(int irq, void *data) · 102 unmodified lines
919911 if (srcs & P_IRQ)
920912 tasklet_schedule(&bdev->task);
921913
922− ret = bam_pm_runtime_get_sync(bdev->dev);
914+ ret = pm_runtime_get_sync(bdev->dev);
923915 if (ret < 0)
924916 return IRQ_NONE;
925917
@@ -1037,7 +1029,7 @@ static void bam_start_dma(struct bam_chan *bchan) · 111 unmodified lines
10371029 if (!vd)
10381030 return;
10391031
1040− ret = bam_pm_runtime_get_sync(bdev->dev);
1032+ ret = pm_runtime_get_sync(bdev->dev);
10411033 if (ret < 0)
10421034 return;
10431035
@@ -1374,11 +1366,6 @@ static int bam_dma_probe(struct platform_device *pdev) · 330 unmodified lines
13741366 if (ret)
13751367 goto err_unregister_dma;
13761368
1377− if (!bdev->bamclk) {
1378− pm_runtime_disable(&pdev->dev);
1379− return 0;
1380− }
1381−
13821369 pm_runtime_irq_safe(&pdev->dev);
13831370 pm_runtime_set_autosuspend_delay(&pdev->dev, BAM_DMA_AUTOSUSPEND_DELAY);
13841371 pm_runtime_use_autosuspend(&pdev->dev);
@@ -1462,10 +1449,8 @@ static int __maybe_unused bam_dma_suspend(struct device *dev) · 77 unmodified lines
14621449 {
14631450 struct bam_device *bdev = dev_get_drvdata(dev);
14641451
1465− if (bdev->bamclk) {
1466− pm_runtime_force_suspend(dev);
1467− clk_unprepare(bdev->bamclk);
1468− }
1452+ pm_runtime_force_suspend(dev);
1453+ clk_unprepare(bdev->bamclk);
14691454
14701455 return 0;
14711456 }
@@ -1475,13 +1460,11 @@ static int __maybe_unused bam_dma_resume(struct device *dev) · 3 unmodified lines
14751460 struct bam_device *bdev = dev_get_drvdata(dev);
14761461 int ret;
14771462
1478− if (bdev->bamclk) {
1479− ret = clk_prepare(bdev->bamclk);
1480− if (ret)
1481− return ret;
1463+ ret = clk_prepare(bdev->bamclk);
1464+ if (ret)
1465+ return ret;
14821466
1483− pm_runtime_force_resume(dev);
1484− }
1467+ pm_runtime_force_resume(dev);
14851468
14861469 return 0;
14871470 }