Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

spi: cadence: fix unclocked access on unbind

Make sure that the controller is runtime resumed before disabling it
during driver unbind to avoid unclocked register access and unbalanced
clock disable.

Also restore the autosuspend setting.

This issue was flagged by Sashiko when reviewing a controller
deregistration fix.

Fixes: d36ccd9f7ea4 ("spi: cadence: Runtime pm adaptation")
Cc: stable@vger.kernel.org # 4.7
Cc: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Link: https://sashiko.dev/#/patchset/20260414134319.978196-1-johan%40kernel.org?part=1
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20260421123615.1533617-2-johan@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Johan Hovold and committed by
Mark Brown
5b1689a4 254f4963

+8 -1
+8 -1
drivers/spi/spi-cadence.c
··· 776 776 { 777 777 struct spi_controller *ctlr = platform_get_drvdata(pdev); 778 778 struct cdns_spi *xspi = spi_controller_get_devdata(ctlr); 779 + int ret = 0; 780 + 781 + if (!spi_controller_is_target(ctlr)) 782 + ret = pm_runtime_get_sync(&pdev->dev); 779 783 780 784 spi_controller_get(ctlr); 781 785 782 786 spi_unregister_controller(ctlr); 783 787 784 - cdns_spi_write(xspi, CDNS_SPI_ER, CDNS_SPI_ER_DISABLE); 788 + if (ret >= 0) 789 + cdns_spi_write(xspi, CDNS_SPI_ER, CDNS_SPI_ER_DISABLE); 785 790 786 791 if (!spi_controller_is_target(ctlr)) { 787 792 pm_runtime_disable(&pdev->dev); 788 793 pm_runtime_set_suspended(&pdev->dev); 794 + pm_runtime_put_noidle(&pdev->dev); 795 + pm_runtime_dont_use_autosuspend(&pdev->dev); 789 796 } 790 797 791 798 spi_controller_put(ctlr);