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.
Unified · Split
| @@ -558,14 +558,6 @@ static int bam_alloc_chan(struct dma_chan *chan) · 557 unmodified lines | ||
| 558 | 558 | return 0; |
| 559 | 559 | } |
| 560 | 560 | |
| 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 | − | |
| 569 | 561 | /** |
| 570 | 562 | * bam_free_chan - Frees dma resources associated with specific channel |
| 571 | 563 | * @chan: specified channel |
| @@ -581,7 +573,7 @@ static void bam_free_chan(struct dma_chan *chan) · 9 unmodified lines | ||
| 581 | 573 | unsigned long flags; |
| 582 | 574 | int ret; |
| 583 | 575 | |
| 584 | − ret = bam_pm_runtime_get_sync(bdev->dev); | |
| 576 | + ret = pm_runtime_get_sync(bdev->dev); | |
| 585 | 577 | if (ret < 0) |
| 586 | 578 | return; |
| 587 | 579 | |
| @@ -784,7 +776,7 @@ static int bam_pause(struct dma_chan *chan) · 196 unmodified lines | ||
| 784 | 776 | unsigned long flag; |
| 785 | 777 | int ret; |
| 786 | 778 | |
| 787 | − ret = bam_pm_runtime_get_sync(bdev->dev); | |
| 779 | + ret = pm_runtime_get_sync(bdev->dev); | |
| 788 | 780 | if (ret < 0) |
| 789 | 781 | return ret; |
| 790 | 782 | |
| @@ -810,7 +802,7 @@ static int bam_resume(struct dma_chan *chan) · 19 unmodified lines | ||
| 810 | 802 | unsigned long flag; |
| 811 | 803 | int ret; |
| 812 | 804 | |
| 813 | − ret = bam_pm_runtime_get_sync(bdev->dev); | |
| 805 | + ret = pm_runtime_get_sync(bdev->dev); | |
| 814 | 806 | if (ret < 0) |
| 815 | 807 | return ret; |
| 816 | 808 | |
| @@ -919,7 +911,7 @@ static irqreturn_t bam_dma_irq(int irq, void *data) · 102 unmodified lines | ||
| 919 | 911 | if (srcs & P_IRQ) |
| 920 | 912 | tasklet_schedule(&bdev->task); |
| 921 | 913 | |
| 922 | − ret = bam_pm_runtime_get_sync(bdev->dev); | |
| 914 | + ret = pm_runtime_get_sync(bdev->dev); | |
| 923 | 915 | if (ret < 0) |
| 924 | 916 | return IRQ_NONE; |
| 925 | 917 | |
| @@ -1037,7 +1029,7 @@ static void bam_start_dma(struct bam_chan *bchan) · 111 unmodified lines | ||
| 1037 | 1029 | if (!vd) |
| 1038 | 1030 | return; |
| 1039 | 1031 | |
| 1040 | − ret = bam_pm_runtime_get_sync(bdev->dev); | |
| 1032 | + ret = pm_runtime_get_sync(bdev->dev); | |
| 1041 | 1033 | if (ret < 0) |
| 1042 | 1034 | return; |
| 1043 | 1035 | |
| @@ -1374,11 +1366,6 @@ static int bam_dma_probe(struct platform_device *pdev) · 330 unmodified lines | ||
| 1374 | 1366 | if (ret) |
| 1375 | 1367 | goto err_unregister_dma; |
| 1376 | 1368 | |
| 1377 | − if (!bdev->bamclk) { | |
| 1378 | − pm_runtime_disable(&pdev->dev); | |
| 1379 | − return 0; | |
| 1380 | − } | |
| 1381 | − | |
| 1382 | 1369 | pm_runtime_irq_safe(&pdev->dev); |
| 1383 | 1370 | pm_runtime_set_autosuspend_delay(&pdev->dev, BAM_DMA_AUTOSUSPEND_DELAY); |
| 1384 | 1371 | pm_runtime_use_autosuspend(&pdev->dev); |
| @@ -1462,10 +1449,8 @@ static int __maybe_unused bam_dma_suspend(struct device *dev) · 77 unmodified lines | ||
| 1462 | 1449 | { |
| 1463 | 1450 | struct bam_device *bdev = dev_get_drvdata(dev); |
| 1464 | 1451 | |
| 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); | |
| 1469 | 1454 | |
| 1470 | 1455 | return 0; |
| 1471 | 1456 | } |
| @@ -1475,13 +1460,11 @@ static int __maybe_unused bam_dma_resume(struct device *dev) · 3 unmodified lines | ||
| 1475 | 1460 | struct bam_device *bdev = dev_get_drvdata(dev); |
| 1476 | 1461 | int ret; |
| 1477 | 1462 | |
| 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; | |
| 1482 | 1466 | |
| 1483 | − pm_runtime_force_resume(dev); | |
| 1484 | − } | |
| 1467 | + pm_runtime_force_resume(dev); | |
| 1485 | 1468 | |
| 1486 | 1469 | return 0; |
| 1487 | 1470 | } |