Skip to content

Commit 72972ab

Browse files
jhovoldgregkh
authored andcommitted
spi: atmel: fix controller deregistration
commit 8d4de97 upstream. Make sure to deregister the controller before disabling underlying resources like clocks during driver unbind. Fixes: 754ce4f ("[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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c66a6f2 commit 72972ab

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

drivers/spi/spi-atmel.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1655,7 +1655,7 @@ static int atmel_spi_probe(struct platform_device *pdev)
16551655
pm_runtime_set_active(&pdev->dev);
16561656
pm_runtime_enable(&pdev->dev);
16571657

1658-
ret = devm_spi_register_controller(&pdev->dev, host);
1658+
ret = spi_register_controller(host);
16591659
if (ret)
16601660
goto out_free_dma;
16611661

@@ -1689,8 +1689,12 @@ static void atmel_spi_remove(struct platform_device *pdev)
16891689
struct spi_controller *host = platform_get_drvdata(pdev);
16901690
struct atmel_spi *as = spi_controller_get_devdata(host);
16911691

1692+
spi_controller_get(host);
1693+
16921694
pm_runtime_get_sync(&pdev->dev);
16931695

1696+
spi_unregister_controller(host);
1697+
16941698
/* reset the hardware and block queue progress */
16951699
if (as->use_dma) {
16961700
atmel_spi_stop_dma(host);
@@ -1717,6 +1721,8 @@ static void atmel_spi_remove(struct platform_device *pdev)
17171721

17181722
pm_runtime_put_noidle(&pdev->dev);
17191723
pm_runtime_disable(&pdev->dev);
1724+
1725+
spi_controller_put(host);
17201726
}
17211727

17221728
static int atmel_spi_runtime_suspend(struct device *dev)

0 commit comments

Comments
 (0)