mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 10:09:10 +02:00
spi: st-ssc4: 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/20260505072909.618363-12-johan@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
d68627cc76
commit
d3cf5ebdf1
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user