2021-01-07 13:30:34

by Daniel Scally

[permalink] [raw]
Subject: [PATCH v5 04/15] device property: Call fwnode_graph_get_endpoint_by_id() for fwnode->secondary

This function is used to find fwnode endpoints against a device. In
some instances those endpoints are software nodes which are children of
fwnode->secondary. Add support to fwnode_graph_get_endpoint_by_id() to
find those endpoints by recursively calling itself passing the ptr to
fwnode->secondary in the event no endpoint is found for the primary.

Reviewed-by: Andy Shevchenko <[email protected]>
Reviewed-by: Laurent Pinchart <[email protected]>
Acked-by: Sakari Ailus <[email protected]>
Signed-off-by: Daniel Scally <[email protected]>
---
Changes in v5:

- Changed the commit subject

drivers/base/property.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/base/property.c b/drivers/base/property.c
index 0bf5260f14c6..1421e9548857 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -1215,7 +1215,14 @@ fwnode_graph_get_endpoint_by_id(const struct fwnode_handle *fwnode,
best_ep_id = fwnode_ep.id;
}

- return best_ep;
+ if (best_ep)
+ return best_ep;
+
+ if (fwnode && !IS_ERR_OR_NULL(fwnode->secondary))
+ return fwnode_graph_get_endpoint_by_id(fwnode->secondary, port,
+ endpoint, flags);
+
+ return NULL;
}
EXPORT_SYMBOL_GPL(fwnode_graph_get_endpoint_by_id);

--
2.25.1


2021-01-10 15:11:14

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v5 04/15] device property: Call fwnode_graph_get_endpoint_by_id() for fwnode->secondary

On Thu, Jan 07, 2021 at 01:28:27PM +0000, Daniel Scally wrote:
> This function is used to find fwnode endpoints against a device. In
> some instances those endpoints are software nodes which are children of
> fwnode->secondary. Add support to fwnode_graph_get_endpoint_by_id() to
> find those endpoints by recursively calling itself passing the ptr to
> fwnode->secondary in the event no endpoint is found for the primary.
>
> Reviewed-by: Andy Shevchenko <[email protected]>
> Reviewed-by: Laurent Pinchart <[email protected]>
> Acked-by: Sakari Ailus <[email protected]>
> Signed-off-by: Daniel Scally <[email protected]>
> ---
> Changes in v5:
>
> - Changed the commit subject
>
> drivers/base/property.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)

Acked-by: Greg Kroah-Hartman <[email protected]>