[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230322040933.924813-3-tanmay.shah@amd.com>
Date: Tue, 21 Mar 2023 21:09:36 -0700
From: Tanmay Shah <tanmay.shah@....com>
To: <andersson@...nel.org>, <mathieu.poirier@...aro.org>
CC: <linux-remoteproc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
Tanmay Shah <tanmay.shah@....com>,
Tarak Reddy <tarak.reddy@....com>
Subject: [PATCH v2 2/2] remoteproc: enhance rproc_put() for clusters
This patch enhances rproc_put() to support remoteproc clusters
with multiple child nodes as in rproc_get_by_phandle().
Signed-off-by: Tarak Reddy <tarak.reddy@....com>
Signed-off-by: Tanmay Shah <tanmay.shah@....com>
---
drivers/remoteproc/remoteproc_core.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index a3e7c8798381..e7e451012615 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -2560,6 +2560,19 @@ EXPORT_SYMBOL(rproc_free);
void rproc_put(struct rproc *rproc)
{
module_put(rproc->dev.parent->driver->owner);
+ struct platform_device *cluster_pdev;
+
+ if (rproc->dev.parent) {
+ if (rproc->dev.parent->driver) {
+ module_put(rproc->dev.parent->driver->owner);
+ } else {
+ cluster_pdev = of_find_device_by_node(rproc->dev.parent->of_node->parent);
+ if (cluster_pdev) {
+ module_put(cluster_pdev->dev.driver->owner);
+ put_device(&cluster_pdev->dev);
+ }
+ }
+ }
put_device(&rproc->dev);
}
EXPORT_SYMBOL(rproc_put);
--
2.25.1
Powered by blists - more mailing lists