]> Git Repo - linux.git/commitdiff
spi: zynqmp-gqspi: fix clock imbalance on probe failure
authorJohan Hovold <[email protected]>
Thu, 22 Jun 2023 08:24:35 +0000 (10:24 +0200)
committerMark Brown <[email protected]>
Thu, 22 Jun 2023 14:02:31 +0000 (15:02 +0100)
Make sure that the device is not runtime suspended before explicitly
disabling the clocks on probe failure and on driver unbind to avoid a
clock enable-count imbalance.

Fixes: 9e3a000362ae ("spi: zynqmp: Add pm runtime support")
Cc: [email protected] # 4.19
Cc: Naga Sureshkumar Relli <[email protected]>
Cc: Shubhrajyoti Datta <[email protected]>
Signed-off-by: Johan Hovold <[email protected]>
Link: https://lore.kernel.org/r/Message-Id:
Signed-off-by: Mark Brown <[email protected]>
drivers/spi/spi-zynqmp-gqspi.c

index fb2ca9b90eabf1a419051639480d94f2ce59d129..c309dedfd6020becd59f0499dd24952b2200c743 100644 (file)
@@ -1342,9 +1342,9 @@ static int zynqmp_qspi_probe(struct platform_device *pdev)
        return 0;
 
 clk_dis_all:
-       pm_runtime_put_sync(&pdev->dev);
-       pm_runtime_set_suspended(&pdev->dev);
        pm_runtime_disable(&pdev->dev);
+       pm_runtime_put_noidle(&pdev->dev);
+       pm_runtime_set_suspended(&pdev->dev);
        clk_disable_unprepare(xqspi->refclk);
 clk_dis_pclk:
        clk_disable_unprepare(xqspi->pclk);
@@ -1368,11 +1368,15 @@ static void zynqmp_qspi_remove(struct platform_device *pdev)
 {
        struct zynqmp_qspi *xqspi = platform_get_drvdata(pdev);
 
+       pm_runtime_get_sync(&pdev->dev);
+
        zynqmp_gqspi_write(xqspi, GQSPI_EN_OFST, 0x0);
+
+       pm_runtime_disable(&pdev->dev);
+       pm_runtime_put_noidle(&pdev->dev);
+       pm_runtime_set_suspended(&pdev->dev);
        clk_disable_unprepare(xqspi->refclk);
        clk_disable_unprepare(xqspi->pclk);
-       pm_runtime_set_suspended(&pdev->dev);
-       pm_runtime_disable(&pdev->dev);
 }
 
 MODULE_DEVICE_TABLE(of, zynqmp_qspi_of_match);
This page took 0.067511 seconds and 4 git commands to generate.