[PATCH 4.19.y-cip 02/40] media: device property: Add a function to test is a fwnode is a graph endpoint

Lad Prabhakar

From: Laurent Pinchart <laurent.pinchart+renesas@...>

commit 35694afc92646ac24d7f3ef34a7387876d998fe7 upstream.

Drivers may need to test if a fwnode is a graph endpoint. To avoid
hand-written solutions that wouldn't work for all fwnode types, add a
new fwnode_graph_is_endpoint() function for this purpose. We don't need
to wire it up to different backends for OF and ACPI for now, as the
implementation can simply be based on checkout the presence of a
remote-endpoint property.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@...>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@...>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@...>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@...>
Signed-off-by: Sakari Ailus <sakari.ailus@...>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@...>
[PL: manually applied the changes]
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@...>
include/linux/property.h | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/include/linux/property.h b/include/linux/property.h
index 216dcfe567df..ec8ebd73b2c4 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -308,6 +308,11 @@ struct fwnode_handle *
fwnode_graph_get_remote_node(const struct fwnode_handle *fwnode, u32 port,
u32 endpoint);

+static inline bool fwnode_graph_is_endpoint(struct fwnode_handle *fwnode)
+ return fwnode_property_present(fwnode, "remote-endpoint");
#define fwnode_graph_for_each_endpoint(fwnode, child) \
for (child = NULL; \
(child = fwnode_graph_get_next_endpoint(fwnode, child)); )

Join cip-dev@lists.cip-project.org to automatically receive all group messages.