Linux-remoteproc Archive mirror
 help / color / mirror / Atom feed
From: Andrew Davis <afd@ti.com>
To: Hari Nagalla <hnagalla@ti.com>,
	Bjorn Andersson <andersson@kernel.org>,
	Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: <linux-remoteproc@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, Andrew Davis <afd@ti.com>
Subject: [PATCH 6/7] remoteproc: keystone: Use devm_gpiod_get() helper
Date: Fri, 2 Aug 2024 13:22:59 -0500	[thread overview]
Message-ID: <20240802182300.244055-6-afd@ti.com> (raw)
In-Reply-To: <20240802182300.244055-1-afd@ti.com>

Use device life-cycle managed GPIO get function to simplify probe
and exit paths.

Signed-off-by: Andrew Davis <afd@ti.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


  parent reply	other threads:[~2024-08-02 18:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-02 18:22 [PATCH 1/7] remoteproc: keystone: Use devm_kasprintf() to build name string Andrew Davis
2024-08-02 18:22 ` [PATCH 2/7] remoteproc: keystone: Use devm_rproc_alloc() helper Andrew Davis
2024-08-02 18:22 ` [PATCH 3/7] remoteproc: keystone: Use devm action to release reserved memory Andrew Davis
2024-08-13 15:55   ` Mathieu Poirier
2024-08-02 18:22 ` [PATCH 4/7] remoteproc: keystone: Use devm_pm_runtime_enable() helper Andrew Davis
2024-08-02 18:22 ` [PATCH 5/7] remoteproc: keystone: Use devm action to call PM runtime put sync Andrew Davis
2024-08-02 18:22 ` Andrew Davis [this message]
2024-08-02 18:23 ` [PATCH 7/7] remoteproc: keystone: Use devm_rproc_add() helper Andrew Davis
2024-08-08 11:34 ` [PATCH 1/7] remoteproc: keystone: Use devm_kasprintf() to build name string Hari Nagalla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240802182300.244055-6-afd@ti.com \
    --to=afd@ti.com \
    --cc=andersson@kernel.org \
    --cc=hnagalla@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).