summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2026-04-29 11:13:28 +0200
committerMark Brown <broonie@kernel.org>2026-05-04 22:09:29 +0900
commit8cecd707d5358b88bcd0ae49f2f38e143d6bf7da (patch)
tree726220ad129777fe59b2c5bcb64f6f2ea32e71eb
parent8015cac85a698d471f100ca8602c27448bee146b (diff)
spi: lantiq-ssc: 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-15-johan@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/spi/spi-lantiq-ssc.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/drivers/spi/spi-lantiq-ssc.c b/drivers/spi/spi-lantiq-ssc.c
index 75b9af8cb5db..ecae50a50b14 100644
--- a/drivers/spi/spi-lantiq-ssc.c
+++ b/drivers/spi/spi-lantiq-ssc.c
@@ -913,7 +913,7 @@ static int lantiq_ssc_probe(struct platform_device *pdev)
hwcfg = of_device_get_match_data(dev);
- host = spi_alloc_host(dev, sizeof(struct lantiq_ssc_spi));
+ host = devm_spi_alloc_host(dev, sizeof(struct lantiq_ssc_spi));
if (!host)
return -ENOMEM;
@@ -923,20 +923,16 @@ static int lantiq_ssc_probe(struct platform_device *pdev)
spi->hwcfg = hwcfg;
platform_set_drvdata(pdev, spi);
spi->regbase = devm_platform_ioremap_resource(pdev, 0);
- if (IS_ERR(spi->regbase)) {
- err = PTR_ERR(spi->regbase);
- goto err_host_put;
- }
+ if (IS_ERR(spi->regbase))
+ return PTR_ERR(spi->regbase);
err = hwcfg->cfg_irq(pdev, spi);
if (err)
- goto err_host_put;
+ return err;
spi->spi_clk = devm_clk_get_enabled(dev, "gate");
- if (IS_ERR(spi->spi_clk)) {
- err = PTR_ERR(spi->spi_clk);
- goto err_host_put;
- }
+ if (IS_ERR(spi->spi_clk))
+ return PTR_ERR(spi->spi_clk);
/*
* Use the old clk_get_fpi() function on Lantiq platform, till it
@@ -947,10 +943,8 @@ static int lantiq_ssc_probe(struct platform_device *pdev)
#else
spi->fpi_clk = clk_get(dev, "freq");
#endif
- if (IS_ERR(spi->fpi_clk)) {
- err = PTR_ERR(spi->fpi_clk);
- goto err_host_put;
- }
+ if (IS_ERR(spi->fpi_clk))
+ return PTR_ERR(spi->fpi_clk);
num_cs = 8;
of_property_read_u32(pdev->dev.of_node, "num-cs", &num_cs);
@@ -1006,8 +1000,6 @@ err_wq_destroy:
destroy_workqueue(spi->wq);
err_clk_put:
clk_put(spi->fpi_clk);
-err_host_put:
- spi_controller_put(host);
return err;
}
@@ -1016,8 +1008,6 @@ static void lantiq_ssc_remove(struct platform_device *pdev)
{
struct lantiq_ssc_spi *spi = platform_get_drvdata(pdev);
- spi_controller_get(spi->host);
-
spi_unregister_controller(spi->host);
lantiq_ssc_writel(spi, 0, LTQ_SPI_IRNEN);
@@ -1028,8 +1018,6 @@ static void lantiq_ssc_remove(struct platform_device *pdev)
destroy_workqueue(spi->wq);
clk_put(spi->fpi_clk);
-
- spi_controller_put(spi->host);
}
static struct platform_driver lantiq_ssc_driver = {