[RFC 11/18] remoteproc: Add child node component in rproc match list

From: Arnaud Pouliquen
Date: Thu Apr 16 2020 - 12:15:32 EST


Add the components, associated to the child devices populated, in
the match list for synchronization relying on bind/unbind mechanism.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@xxxxxx>
---
drivers/remoteproc/remoteproc_core.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 75f84fd3bd60..ecb36f64b1a0 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -1608,6 +1608,8 @@ static void rproc_crash_handler_work(struct work_struct *work)
static int rproc_platform_populate(struct rproc *rproc)
{
struct device *dev = rproc->dev.parent;
+ struct device_node *node = dev->of_node;
+ struct device_node *child_np;
int ret;

ret = of_platform_populate(dev->of_node, NULL, NULL, dev);
@@ -1617,6 +1619,19 @@ static int rproc_platform_populate(struct rproc *rproc)
goto depopulate;
}

+ child_np = of_get_next_available_child(node, NULL);
+
+ while (child_np) {
+ of_node_get(node);
+ component_match_add_release(dev, &rproc->match,
+ rproc_release_of, rproc_compare_of,
+ child_np);
+ child_np = of_get_next_available_child(node, child_np);
+ }
+
+ if (!rproc->match)
+ dev_dbg(dev, "No available child\n");
+
return 0;

depopulate:
--
2.17.1