]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
spi: atmel: fix controller deregistration
authorJohan Hovold <johan@kernel.org>
Thu, 9 Apr 2026 12:04:03 +0000 (14:04 +0200)
committerMark Brown <broonie@kernel.org>
Thu, 9 Apr 2026 19:08:01 +0000 (20:08 +0100)
Make sure to deregister the controller before disabling underlying
resources like clocks during driver unbind.

Fixes: 754ce4f29937 ("[PATCH] SPI: atmel_spi driver")
Cc: stable@vger.kernel.org # 2.6.21
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20260409120419.388546-5-johan@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-atmel.c

index 445d645585bf35faee25ccda7b3cd6c292a5b031..42db85d7ff8e13637b52d56e38f9023e25a2c3a0 100644 (file)
@@ -1654,7 +1654,7 @@ static int atmel_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)
                goto out_free_dma;
 
@@ -1688,8 +1688,12 @@ static void atmel_spi_remove(struct platform_device *pdev)
        struct spi_controller   *host = platform_get_drvdata(pdev);
        struct atmel_spi        *as = spi_controller_get_devdata(host);
 
+       spi_controller_get(host);
+
        pm_runtime_get_sync(&pdev->dev);
 
+       spi_unregister_controller(host);
+
        /* reset the hardware and block queue progress */
        if (as->use_dma) {
                atmel_spi_stop_dma(host);
@@ -1716,6 +1720,8 @@ static void atmel_spi_remove(struct platform_device *pdev)
 
        pm_runtime_put_noidle(&pdev->dev);
        pm_runtime_disable(&pdev->dev);
+
+       spi_controller_put(host);
 }
 
 static int atmel_spi_runtime_suspend(struct device *dev)