summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2026-04-10 11:17:45 +0300
committerMark Brown <broonie@kernel.org>2026-04-10 15:22:36 +0300
commitab840cbda4fe6c40e52f6415c47056797c663bb2 (patch)
tree5c65725ab8083bace55bb47b6fc8d8ae11b9aeee
parent0f25236694a2854627c1597465a071e6bb6fe572 (diff)
downloadlinux-ab840cbda4fe6c40e52f6415c47056797c663bb2.tar.xz
spi: slave-mt27xx: fix controller deregistration
Make sure to deregister the controller before disabling underlying resources like clocks (by disabling runtime PM) during driver unbind. Fixes: 805be7ddf367 ("spi: mediatek: add spi slave for Mediatek MT2712") Cc: stable@vger.kernel.org # 4.20 Cc: Leilk Liu <leilk.liu@mediatek.com> Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20260410081757.503099-16-johan@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/spi/spi-slave-mt27xx.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/spi/spi-slave-mt27xx.c b/drivers/spi/spi-slave-mt27xx.c
index ce889cb33228..7aedeaa5889d 100644
--- a/drivers/spi/spi-slave-mt27xx.c
+++ b/drivers/spi/spi-slave-mt27xx.c
@@ -453,7 +453,7 @@ static int mtk_spi_slave_probe(struct platform_device *pdev)
pm_runtime_enable(&pdev->dev);
- ret = devm_spi_register_controller(&pdev->dev, ctlr);
+ ret = spi_register_controller(ctlr);
clk_disable_unprepare(mdata->spi_clk);
if (ret) {
dev_err(&pdev->dev,
@@ -473,7 +473,15 @@ err_put_ctlr:
static void mtk_spi_slave_remove(struct platform_device *pdev)
{
+ struct spi_controller *ctlr = platform_get_drvdata(pdev);
+
+ spi_controller_get(ctlr);
+
+ spi_unregister_controller(ctlr);
+
pm_runtime_disable(&pdev->dev);
+
+ spi_controller_put(ctlr);
}
#ifdef CONFIG_PM_SLEEP