Skip to content

Commit 67d4a70

Browse files
Jinjie Ruanbroonie
authored andcommitted
spi: spi-cadence: Fix pm_runtime_set_suspended() with runtime pm enabled
It is not valid to call pm_runtime_set_suspended() for devices with runtime PM enabled because it returns -EAGAIN if it is enabled already and working. So, call pm_runtime_disable() before to fix it. Fixes: d36ccd9 ("spi: cadence: Runtime pm adaptation") Signed-off-by: Jinjie Ruan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent b6e05ba commit 67d4a70

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/spi/spi-cadence.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -678,8 +678,8 @@ static int cdns_spi_probe(struct platform_device *pdev)
678678

679679
clk_dis_all:
680680
if (!spi_controller_is_target(ctlr)) {
681-
pm_runtime_set_suspended(&pdev->dev);
682681
pm_runtime_disable(&pdev->dev);
682+
pm_runtime_set_suspended(&pdev->dev);
683683
}
684684
remove_ctlr:
685685
spi_controller_put(ctlr);
@@ -701,8 +701,8 @@ static void cdns_spi_remove(struct platform_device *pdev)
701701

702702
cdns_spi_write(xspi, CDNS_SPI_ER, CDNS_SPI_ER_DISABLE);
703703

704-
pm_runtime_set_suspended(&pdev->dev);
705704
pm_runtime_disable(&pdev->dev);
705+
pm_runtime_set_suspended(&pdev->dev);
706706

707707
spi_unregister_controller(ctlr);
708708
}

0 commit comments

Comments
 (0)