]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
spi: sun6i: fix controller deregistration
authorJohan Hovold <johan@kernel.org>
Fri, 10 Apr 2026 08:17:49 +0000 (10:17 +0200)
committerMark Brown <broonie@kernel.org>
Fri, 10 Apr 2026 12:22:39 +0000 (13:22 +0100)
Make sure to deregister the controller before disabling underlying
resources like clocks during driver unbind.

Fixes: 3558fe900e8a ("spi: sunxi: Add Allwinner A31 SPI controller driver")
Cc: stable@vger.kernel.org # 3.15
Cc: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20260410081757.503099-20-johan@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-sun6i.c

index 240e46f84f7b34516c5534f9c434decf1a5dff41..5ac73d324d0630d81856bbfc1f9050d9f11fbe1f 100644 (file)
@@ -742,7 +742,7 @@ static int sun6i_spi_probe(struct platform_device *pdev)
        pm_runtime_set_active(&pdev->dev);
        pm_runtime_enable(&pdev->dev);
 
-       ret = devm_spi_register_controller(&pdev->dev, host);
+       ret = spi_register_controller(host);
        if (ret) {
                dev_err(&pdev->dev, "cannot register SPI host\n");
                goto err_pm_disable;
@@ -768,12 +768,18 @@ static void sun6i_spi_remove(struct platform_device *pdev)
 {
        struct spi_controller *host = platform_get_drvdata(pdev);
 
+       spi_controller_get(host);
+
+       spi_unregister_controller(host);
+
        pm_runtime_force_suspend(&pdev->dev);
 
        if (host->dma_tx)
                dma_release_channel(host->dma_tx);
        if (host->dma_rx)
                dma_release_channel(host->dma_rx);
+
+       spi_controller_put(host);
 }
 
 static const struct sun6i_spi_cfg sun6i_a31_spi_cfg = {