mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Beleswar Padhi <b-padhi@ti.com>
To: <andersson@kernel.org>, <mathieu.poirier@linaro.org>
Cc: <afd@ti.com>, <hnagalla@ti.com>, <u-kumar1@ti.com>,
	<jan.kiszka@siemens.com>, <christophe.jaillet@wanadoo.fr>,
	<jkangas@redhat.com>, <eballetbo@redhat.com>, <b-padhi@ti.com>,
	<linux-remoteproc@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: [PATCH v2 4/5] remoteproc: k3-r5: Use devm_rproc_add() helper
Date: Thu, 19 Dec 2024 16:35:44 +0530	[thread overview]
Message-ID: <20241219110545.1898883-5-b-padhi@ti.com> (raw)
In-Reply-To: <20241219110545.1898883-1-b-padhi@ti.com>

Use device lifecycle managed devm_rproc_add() helper function. This
helps prevent mistakes like deleting out of order in cleanup functions
and forgetting to delete on all error paths.

Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
---
v2: Changelog:
1. Re-ordered [PATCH 5/5] from v1 to [PATCH v2 4/5] in v2. [Andrew]
2. Removed redundant rproc_del() call in k3_r5_cluster_rproc_init() as
devm_rproc_add is used.

Link to v1:
https://lore.kernel.org/all/20241204111130.2218497-6-b-padhi@ti.com/

 drivers/remoteproc/ti_k3_r5_remoteproc.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/remoteproc/ti_k3_r5_remoteproc.c b/drivers/remoteproc/ti_k3_r5_remoteproc.c
index 3493bae95fdf..30b72bcb4d68 100644
--- a/drivers/remoteproc/ti_k3_r5_remoteproc.c
+++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c
@@ -1266,7 +1266,7 @@ static int k3_r5_cluster_rproc_init(struct platform_device *pdev)
 			goto out;
 		}
 
-		ret = rproc_add(rproc);
+		ret = devm_rproc_add(dev, rproc);
 		if (ret) {
 			dev_err_probe(dev, ret, "rproc_add failed\n");
 			goto out;
@@ -1297,7 +1297,7 @@ static int k3_r5_cluster_rproc_init(struct platform_device *pdev)
 			dev_err(dev,
 				"Timed out waiting for %s core to power up!\n",
 				rproc->name);
-			goto err_powerup;
+			goto out;
 		}
 	}
 
@@ -1313,8 +1313,6 @@ static int k3_r5_cluster_rproc_init(struct platform_device *pdev)
 		}
 	}
 
-err_powerup:
-	rproc_del(rproc);
 out:
 	/* undo core0 upon any failures on core1 in split-mode */
 	if (cluster->mode == CLUSTER_MODE_SPLIT && core == core1) {
@@ -1357,8 +1355,6 @@ static void k3_r5_cluster_rproc_exit(void *data)
 		}
 
 		mbox_free_channel(kproc->mbox);
-
-		rproc_del(rproc);
 	}
 }
 
-- 
2.34.1


  parent reply	other threads:[~2024-12-19 11:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-19 11:05 [PATCH v2 0/5] Use Device Lifecycle managed functions in TI R5 Remoteproc driver Beleswar Padhi
2024-12-19 11:05 ` [PATCH v2 1/5] remoteproc: k3-r5: Add devm action to release reserved memory Beleswar Padhi
2024-12-19 11:05 ` [PATCH v2 2/5] remoteproc: k3-r5: Use devm_kcalloc() helper Beleswar Padhi
2024-12-19 11:05 ` [PATCH v2 3/5] remoteproc: k3-r5: Use devm_ioremap_wc() helper Beleswar Padhi
2024-12-19 11:05 ` Beleswar Padhi [this message]
2024-12-19 11:05 ` [PATCH v2 5/5] remoteproc: k3-r5: Add devm action to release tsp Beleswar Padhi
2024-12-19 14:52 ` [PATCH v2 0/5] Use Device Lifecycle managed functions in TI R5 Remoteproc driver Andrew Davis
2024-12-19 15:23   ` Beleswar Prasad Padhi
2025-01-06 16:56 ` Mathieu Poirier

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=20241219110545.1898883-5-b-padhi@ti.com \
    --to=b-padhi@ti.com \
    --cc=afd@ti.com \
    --cc=andersson@kernel.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=eballetbo@redhat.com \
    --cc=hnagalla@ti.com \
    --cc=jan.kiszka@siemens.com \
    --cc=jkangas@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=u-kumar1@ti.com \
    /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

all inboxes | Powered by JetHome®