Skip to content

Commit 8e235ff

Browse files
committed
Merge tag 'devprop-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull device properties framework updates from Rafael Wysocki: "These improve the handling of secondary firmware nodes in fwnode_graph_get_next_endpoint() (Daniel Scally)" * tag 'devprop-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: Revert "media: device property: Call fwnode_graph_get_endpoint_by_id() for fwnode->secondary" device property: Check fwnode->secondary in fwnode_graph_get_next_endpoint()
2 parents 6f1e8b1 + a908877 commit 8e235ff

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

drivers/base/property.c

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,26 @@ struct fwnode_handle *
10331033
fwnode_graph_get_next_endpoint(const struct fwnode_handle *fwnode,
10341034
struct fwnode_handle *prev)
10351035
{
1036-
return fwnode_call_ptr_op(fwnode, graph_get_next_endpoint, prev);
1036+
const struct fwnode_handle *parent;
1037+
struct fwnode_handle *ep;
1038+
1039+
/*
1040+
* If this function is in a loop and the previous iteration returned
1041+
* an endpoint from fwnode->secondary, then we need to use the secondary
1042+
* as parent rather than @fwnode.
1043+
*/
1044+
if (prev)
1045+
parent = fwnode_graph_get_port_parent(prev);
1046+
else
1047+
parent = fwnode;
1048+
1049+
ep = fwnode_call_ptr_op(parent, graph_get_next_endpoint, prev);
1050+
1051+
if (IS_ERR_OR_NULL(ep) &&
1052+
!IS_ERR_OR_NULL(parent) && !IS_ERR_OR_NULL(parent->secondary))
1053+
ep = fwnode_graph_get_next_endpoint(parent->secondary, NULL);
1054+
1055+
return ep;
10371056
}
10381057
EXPORT_SYMBOL_GPL(fwnode_graph_get_next_endpoint);
10391058

@@ -1212,14 +1231,7 @@ fwnode_graph_get_endpoint_by_id(const struct fwnode_handle *fwnode,
12121231
best_ep_id = fwnode_ep.id;
12131232
}
12141233

1215-
if (best_ep)
1216-
return best_ep;
1217-
1218-
if (fwnode && !IS_ERR_OR_NULL(fwnode->secondary))
1219-
return fwnode_graph_get_endpoint_by_id(fwnode->secondary, port,
1220-
endpoint, flags);
1221-
1222-
return NULL;
1234+
return best_ep;
12231235
}
12241236
EXPORT_SYMBOL_GPL(fwnode_graph_get_endpoint_by_id);
12251237

0 commit comments

Comments
 (0)