Skip to content

Commit 6bf4253

Browse files
jhovoldgregkh
authored andcommitted
spi: sifive: fix controller deregistration
[ Upstream commit 0f25236 ] Make sure to deregister the controller before disabling underlying resources like interrupts during driver unbind. Note that clocks were also disabled before the recent commit 140039c ("spi: sifive: Simplify clock handling with devm_clk_get_enabled()"). Fixes: 484a9a6 ("spi: sifive: Add driver for the SiFive SPI controller") Cc: stable@vger.kernel.org # 5.1 Cc: Yash Shah <yash.shah@sifive.com> Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20260410081757.503099-15-johan@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 27fcf3d commit 6bf4253

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

drivers/spi/spi-sifive.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ static int sifive_spi_probe(struct platform_device *pdev)
393393
dev_info(&pdev->dev, "mapped; irq=%d, cs=%d\n",
394394
irq, host->num_chipselect);
395395

396-
ret = devm_spi_register_controller(&pdev->dev, host);
396+
ret = spi_register_controller(host);
397397
if (ret < 0) {
398398
dev_err(&pdev->dev, "spi_register_host failed\n");
399399
goto put_host;
@@ -412,8 +412,14 @@ static void sifive_spi_remove(struct platform_device *pdev)
412412
struct spi_controller *host = platform_get_drvdata(pdev);
413413
struct sifive_spi *spi = spi_controller_get_devdata(host);
414414

415+
spi_controller_get(host);
416+
417+
spi_unregister_controller(host);
418+
415419
/* Disable all the interrupts just in case */
416420
sifive_spi_write(spi, SIFIVE_SPI_REG_IE, 0);
421+
422+
spi_controller_put(host);
417423
}
418424

419425
static int sifive_spi_suspend(struct device *dev)

0 commit comments

Comments
 (0)