Skip to content

Commit 0830143

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 a2825f2 commit 0830143

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
@@ -1640,7 +1640,7 @@ static int atmel_spi_probe(struct platform_device *pdev)
16401640
pm_runtime_set_active(&pdev->dev);
16411641
pm_runtime_enable(&pdev->dev);
16421642

1643-
ret = devm_spi_register_controller(&pdev->dev, host);
1643+
ret = spi_register_controller(host);
16441644
if (ret)
16451645
goto out_free_dma;
16461646

@@ -1672,8 +1672,12 @@ static void atmel_spi_remove(struct platform_device *pdev)
16721672
struct spi_controller *host = platform_get_drvdata(pdev);
16731673
struct atmel_spi *as = spi_controller_get_devdata(host);
16741674

1675+
spi_controller_get(host);
1676+
16751677
pm_runtime_get_sync(&pdev->dev);
16761678

1679+
spi_unregister_controller(host);
1680+
16771681
/* reset the hardware and block queue progress */
16781682
if (as->use_dma) {
16791683
atmel_spi_stop_dma(host);
@@ -1698,6 +1702,8 @@ static void atmel_spi_remove(struct platform_device *pdev)
16981702

16991703
pm_runtime_put_noidle(&pdev->dev);
17001704
pm_runtime_disable(&pdev->dev);
1705+
1706+
spi_controller_put(host);
17011707
}
17021708

17031709
static int atmel_spi_runtime_suspend(struct device *dev)

0 commit comments

Comments
 (0)