Skip to content

Commit 229cc70

Browse files
jhovoldgregkh
authored andcommitted
spi: sprd: fix controller deregistration
commit 123d17d upstream. Make sure to deregister the controller before disabling underlying resources like clocks during driver unbind. Note that the controller is suspended before disabling and releasing resources since commit de082d8 ("spi: sprd: Add the SPI irq function for the SPI DMA mode") which avoids issues like unclocked accesses but prevents SPI device drivers from doing I/O during deregistration. Fixes: e7d973a ("spi: sprd: Add SPI driver for Spreadtrum SC9860") Cc: stable@vger.kernel.org # 4.20 Cc: Lanqing Liu <lanqing.liu@spreadtrum.com> Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20260410081757.503099-17-johan@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent cdbf6ba commit 229cc70

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

drivers/spi/spi-sprd.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ static int sprd_spi_probe(struct platform_device *pdev)
978978
goto err_rpm_put;
979979
}
980980

981-
ret = devm_spi_register_controller(&pdev->dev, sctlr);
981+
ret = spi_register_controller(sctlr);
982982
if (ret)
983983
goto err_rpm_put;
984984

@@ -1009,7 +1009,9 @@ static void sprd_spi_remove(struct platform_device *pdev)
10091009
if (ret < 0)
10101010
dev_err(ss->dev, "failed to resume SPI controller\n");
10111011

1012-
spi_controller_suspend(sctlr);
1012+
spi_controller_get(sctlr);
1013+
1014+
spi_unregister_controller(sctlr);
10131015

10141016
if (ret >= 0) {
10151017
if (ss->dma.enable)
@@ -1018,6 +1020,8 @@ static void sprd_spi_remove(struct platform_device *pdev)
10181020
}
10191021
pm_runtime_put_noidle(&pdev->dev);
10201022
pm_runtime_disable(&pdev->dev);
1023+
1024+
spi_controller_put(sctlr);
10211025
}
10221026

10231027
static int __maybe_unused sprd_spi_runtime_suspend(struct device *dev)

0 commit comments

Comments
 (0)