]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
spi: sun4i: fix controller deregistration
authorJohan Hovold <johan@kernel.org>
Fri, 10 Apr 2026 08:17:48 +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: b5f6517948cc ("spi: sunxi: Add Allwinner A10 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-19-johan@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-sun4i.c

index bfdf419a583c179004173e4c0e423708c9a0e6c4..b7fbb5270edbc7c1bd89aaaf69284bdbc783ecc8 100644 (file)
@@ -504,7 +504,7 @@ static int sun4i_spi_probe(struct platform_device *pdev)
        pm_runtime_enable(&pdev->dev);
        pm_runtime_idle(&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;
@@ -522,7 +522,15 @@ err_free_host:
 
 static void sun4i_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);
+
+       spi_controller_put(host);
 }
 
 static const struct of_device_id sun4i_spi_match[] = {