diff options
| author | Mark Brown <broonie@kernel.org> | 2026-05-01 10:14:39 +0900 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-05-01 10:14:39 +0900 |
| commit | 8c0f9cd1df41ee029711baca839b99d9592c5dd4 (patch) | |
| tree | 584c6b45f6a8bc1b1d096cf634875edfbfa5ecdc /drivers/spi | |
| parent | 4f12ee0a4d06ba777adc840b22350020dfd35fcf (diff) | |
| parent | ecea4f0e9db2fb6ab4a68a59c5aba0d8f59a9566 (diff) | |
| download | lwn-8c0f9cd1df41ee029711baca839b99d9592c5dd4.tar.gz lwn-8c0f9cd1df41ee029711baca839b99d9592c5dd4.zip | |
spi: cadence: Probe and unbind fixes
Several fixes from Johan for issues with unbind and error handling in
probe.
Diffstat (limited to 'drivers/spi')
| -rw-r--r-- | drivers/spi/spi-cadence.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c index 08d7dabe818d..891e2ba36958 100644 --- a/drivers/spi/spi-cadence.c +++ b/drivers/spi/spi-cadence.c @@ -741,7 +741,6 @@ static int cdns_spi_probe(struct platform_device *pdev) /* Set to default valid value */ ctlr->max_speed_hz = xspi->clk_rate / 4; xspi->speed_hz = ctlr->max_speed_hz; - pm_runtime_put_autosuspend(&pdev->dev); } else { ctlr->mode_bits |= SPI_NO_CS; ctlr->target_abort = cdns_target_abort; @@ -752,12 +751,17 @@ static int cdns_spi_probe(struct platform_device *pdev) goto clk_dis_all; } + if (!spi_controller_is_target(ctlr)) + pm_runtime_put_autosuspend(&pdev->dev); + return ret; clk_dis_all: if (!spi_controller_is_target(ctlr)) { pm_runtime_disable(&pdev->dev); pm_runtime_set_suspended(&pdev->dev); + pm_runtime_put_noidle(&pdev->dev); + pm_runtime_dont_use_autosuspend(&pdev->dev); } remove_ctlr: spi_controller_put(ctlr); @@ -776,16 +780,23 @@ static void cdns_spi_remove(struct platform_device *pdev) { struct spi_controller *ctlr = platform_get_drvdata(pdev); struct cdns_spi *xspi = spi_controller_get_devdata(ctlr); + int ret = 0; + + if (!spi_controller_is_target(ctlr)) + ret = pm_runtime_get_sync(&pdev->dev); spi_controller_get(ctlr); spi_unregister_controller(ctlr); - cdns_spi_write(xspi, CDNS_SPI_ER, CDNS_SPI_ER_DISABLE); + if (ret >= 0) + cdns_spi_write(xspi, CDNS_SPI_ER, CDNS_SPI_ER_DISABLE); if (!spi_controller_is_target(ctlr)) { pm_runtime_disable(&pdev->dev); pm_runtime_set_suspended(&pdev->dev); + pm_runtime_put_noidle(&pdev->dev); + pm_runtime_dont_use_autosuspend(&pdev->dev); } spi_controller_put(ctlr); |
