Messages in this thread Patch in this message |  | | From | Johan Hovold <> | | Subject | [PATCH 11/20] spi: st-ssc4: switch to managed controller allocation | | Date | Tue, 5 May 2026 09:29:00 +0200 |
| |
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> --- drivers/spi/spi-st-ssc4.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/spi/spi-st-ssc4.c b/drivers/spi/spi-st-ssc4.c index 9c8099fe6e19..df61094fc444 100644 --- a/drivers/spi/spi-st-ssc4.c +++ b/drivers/spi/spi-st-ssc4.c @@ -279,7 +279,7 @@ static int spi_st_probe(struct platform_device *pdev) int irq, ret = 0; u32 var; - host = spi_alloc_host(&pdev->dev, sizeof(*spi_st)); + host = devm_spi_alloc_host(&pdev->dev, sizeof(*spi_st)); if (!host) return -ENOMEM; @@ -296,13 +296,12 @@ static int spi_st_probe(struct platform_device *pdev) spi_st->clk = devm_clk_get(&pdev->dev, "ssc"); if (IS_ERR(spi_st->clk)) { dev_err(&pdev->dev, "Unable to request clock\n"); - ret = PTR_ERR(spi_st->clk); - goto put_host; + return PTR_ERR(spi_st->clk); } ret = clk_prepare_enable(spi_st->clk); if (ret) - goto put_host; + return ret; init_completion(&spi_st->done); @@ -361,8 +360,7 @@ static int spi_st_probe(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); clk_disable: clk_disable_unprepare(spi_st->clk); -put_host: - spi_controller_put(host); + return ret; } @@ -371,16 +369,12 @@ static void spi_st_remove(struct platform_device *pdev) struct spi_controller *host = platform_get_drvdata(pdev); struct spi_st *spi_st = spi_controller_get_devdata(host); - spi_controller_get(host); - spi_unregister_controller(host); pm_runtime_disable(&pdev->dev); clk_disable_unprepare(spi_st->clk); - spi_controller_put(host); - pinctrl_pm_select_sleep_state(&pdev->dev); } -- 2.53.0
|  |