diff options
| author | Andrew Davis <afd@ti.com> | 2025-08-14 09:08:33 -0500 |
|---|---|---|
| committer | Mathieu Poirier <mathieu.poirier@linaro.org> | 2025-08-26 09:23:49 -0600 |
| commit | a2ab9cd283ce7daf1b634260a73618733af9d99f (patch) | |
| tree | 24e1def8aac2bcce45b4af9b3b5901ac0d145b1a /drivers/remoteproc | |
| parent | db0427a8a595d0e4880043f9dff8e99c061e5d55 (diff) | |
remoteproc: keystone: Use devm action to call PM runtime put sync
This helps prevent mistakes like putting out of order in cleanup functions
and forgetting to put sync on error paths.
Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20250814140835.651652-3-afd@ti.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Diffstat (limited to 'drivers/remoteproc')
| -rw-r--r-- | drivers/remoteproc/keystone_remoteproc.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/drivers/remoteproc/keystone_remoteproc.c b/drivers/remoteproc/keystone_remoteproc.c index 558678d793b0..558b53575890 100644 --- a/drivers/remoteproc/keystone_remoteproc.c +++ b/drivers/remoteproc/keystone_remoteproc.c @@ -356,6 +356,13 @@ static void keystone_rproc_mem_release(void *data) of_reserved_mem_device_release(dev); } +static void keystone_rproc_pm_runtime_put(void *data) +{ + struct device *dev = data; + + pm_runtime_put_sync(dev); +} + static int keystone_rproc_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -409,29 +416,26 @@ static int keystone_rproc_probe(struct platform_device *pdev) if (ret < 0) return dev_err_probe(dev, ret, "failed to enable clock\n"); + ret = devm_add_action_or_reset(dev, keystone_rproc_pm_runtime_put, dev); + if (ret) + return dev_err_probe(dev, ret, "failed to add disable pm devm action\n"); + ret = keystone_rproc_of_get_memories(pdev, ksproc); if (ret) - goto disable_clk; + return ret; ksproc->irq_ring = platform_get_irq_byname(pdev, "vring"); - if (ksproc->irq_ring < 0) { - ret = ksproc->irq_ring; - goto disable_clk; - } + if (ksproc->irq_ring < 0) + return ksproc->irq_ring; ksproc->irq_fault = platform_get_irq_byname(pdev, "exception"); - if (ksproc->irq_fault < 0) { - ret = ksproc->irq_fault; - goto disable_clk; - } + if (ksproc->irq_fault < 0) + return ksproc->irq_fault; ksproc->kick_gpio = gpiod_get(dev, "kick", GPIOD_ASIS); ret = PTR_ERR_OR_ZERO(ksproc->kick_gpio); - if (ret) { - dev_err(dev, "failed to get gpio for virtio kicks, status = %d\n", - ret); - goto disable_clk; - } + if (ret) + return dev_err_probe(dev, ret, "failed to get gpio for virtio kicks\n"); ret = of_reserved_mem_device_init(dev); if (ret) { @@ -439,7 +443,7 @@ static int keystone_rproc_probe(struct platform_device *pdev) } else { ret = devm_add_action_or_reset(dev, keystone_rproc_mem_release, dev); if (ret) - goto disable_clk; + return ret; } /* ensure the DSP is in reset before loading firmware */ @@ -465,8 +469,6 @@ static int keystone_rproc_probe(struct platform_device *pdev) release_mem: gpiod_put(ksproc->kick_gpio); -disable_clk: - pm_runtime_put_sync(dev); return ret; } @@ -476,7 +478,6 @@ static void keystone_rproc_remove(struct platform_device *pdev) rproc_del(ksproc->rproc); gpiod_put(ksproc->kick_gpio); - pm_runtime_put_sync(&pdev->dev); } static const struct of_device_id keystone_rproc_of_match[] = { |