[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240802182300.244055-6-afd@ti.com>
Date: Fri, 2 Aug 2024 13:22:59 -0500
From: Andrew Davis <afd@...com>
To: Hari Nagalla <hnagalla@...com>, Bjorn Andersson <andersson@...nel.org>,
Mathieu Poirier <mathieu.poirier@...aro.org>
CC: <linux-remoteproc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
Andrew
Davis <afd@...com>
Subject: [PATCH 6/7] remoteproc: keystone: Use devm_gpiod_get() helper
Use device life-cycle managed GPIO get function to simplify probe
and exit paths.
Signed-off-by: Andrew Davis <afd@...com>
---
drivers/remoteproc/keystone_remoteproc.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/drivers/remoteproc/keystone_remoteproc.c b/drivers/remoteproc/keystone_remoteproc.c
index e65f99b1bf379..da5d5969829fb 100644
--- a/drivers/remoteproc/keystone_remoteproc.c
+++ b/drivers/remoteproc/keystone_remoteproc.c
@@ -440,7 +440,7 @@ static int keystone_rproc_probe(struct platform_device *pdev)
if (ksproc->irq_fault < 0)
return ksproc->irq_fault;
- ksproc->kick_gpio = gpiod_get(dev, "kick", GPIOD_ASIS);
+ ksproc->kick_gpio = devm_gpiod_get(dev, "kick", GPIOD_ASIS);
ret = PTR_ERR_OR_ZERO(ksproc->kick_gpio);
if (ret)
return dev_err_probe(dev, ret, "failed to get gpio for virtio kicks\n");
@@ -457,27 +457,19 @@ static int keystone_rproc_probe(struct platform_device *pdev)
/* ensure the DSP is in reset before loading firmware */
ret = reset_control_status(ksproc->reset);
if (ret < 0) {
- dev_err(dev, "failed to get reset status, status = %d\n", ret);
- goto release_mem;
+ return dev_err_probe(dev, ret, "failed to get reset status\n");
} else if (ret == 0) {
WARN(1, "device is not in reset\n");
keystone_rproc_dsp_reset(ksproc);
}
ret = rproc_add(rproc);
- if (ret) {
- dev_err(dev, "failed to add register device with remoteproc core, status = %d\n",
- ret);
- goto release_mem;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to register device with remoteproc core\n");
platform_set_drvdata(pdev, ksproc);
return 0;
-
-release_mem:
- gpiod_put(ksproc->kick_gpio);
- return ret;
}
static void keystone_rproc_remove(struct platform_device *pdev)
@@ -485,7 +477,6 @@ static void keystone_rproc_remove(struct platform_device *pdev)
struct keystone_rproc *ksproc = platform_get_drvdata(pdev);
rproc_del(ksproc->rproc);
- gpiod_put(ksproc->kick_gpio);
}
static const struct of_device_id keystone_rproc_of_match[] = {
--
2.39.2
Powered by blists - more mailing lists