Skip to content

Commit

Permalink
remoteproc: enhance rproc_put() for clusters
Browse files Browse the repository at this point in the history
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@amd.com>
Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
  • Loading branch information
tnmysh authored and intel-lab-lkp committed Mar 22, 2023
1 parent 431e25c commit 573d22d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions drivers/remoteproc/remoteproc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 573d22d

Please sign in to comment.