summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2026-04-29 11:13:30 +0200
committerMark Brown <broonie@kernel.org>2026-05-04 22:09:30 +0900
commitf7c857559eb20a73d2ec6fe79808cdb1f4afabfa (patch)
tree97543a77712bb749b1c21e03d58aee8303b59f31
parent69fb8784c81e0699fbea2ee81f65d1a23bd11649 (diff)
spi: mxs: switch to managed controller allocation
Switch to device managed controller allocation to simplify error handling and to avoid having to take another reference during deregistration. Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20260429091333.165363-17-johan@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/spi/spi-mxs.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c
index 0164e04d59a1..fda1d260b296 100644
--- a/drivers/spi/spi-mxs.c
+++ b/drivers/spi/spi-mxs.c
@@ -563,7 +563,7 @@ static int mxs_spi_probe(struct platform_device *pdev)
if (ret)
clk_freq = clk_freq_default;
- host = spi_alloc_host(&pdev->dev, sizeof(*spi));
+ host = devm_spi_alloc_host(&pdev->dev, sizeof(*spi));
if (!host)
return -ENOMEM;
@@ -589,13 +589,12 @@ static int mxs_spi_probe(struct platform_device *pdev)
ret = devm_request_irq(&pdev->dev, irq_err, mxs_ssp_irq_handler, 0,
dev_name(&pdev->dev), ssp);
if (ret)
- goto out_host_free;
+ return ret;
ssp->dmach = dma_request_chan(&pdev->dev, "rx-tx");
if (IS_ERR(ssp->dmach)) {
dev_err(ssp->dev, "Failed to request DMA\n");
- ret = PTR_ERR(ssp->dmach);
- goto out_host_free;
+ return PTR_ERR(ssp->dmach);
}
pm_runtime_enable(ssp->dev);
@@ -635,8 +634,7 @@ out_pm_runtime_disable:
pm_runtime_disable(ssp->dev);
out_dma_release:
dma_release_channel(ssp->dmach);
-out_host_free:
- spi_controller_put(host);
+
return ret;
}
@@ -650,8 +648,6 @@ static void mxs_spi_remove(struct platform_device *pdev)
spi = spi_controller_get_devdata(host);
ssp = &spi->ssp;
- spi_controller_get(host);
-
spi_unregister_controller(host);
pm_runtime_disable(&pdev->dev);
@@ -659,8 +655,6 @@ static void mxs_spi_remove(struct platform_device *pdev)
mxs_spi_runtime_suspend(&pdev->dev);
dma_release_channel(ssp->dmach);
-
- spi_controller_put(host);
}
static struct platform_driver mxs_spi_driver = {