Commit 507a0ba9 authored by Marco Felsch's avatar Marco Felsch Committed by Mauro Carvalho Chehab

media: v4l2-fwnode: simplify v4l2_fwnode_parse_link

This helper was introduced before those helpers where awailable. Convert
it to cleanup the code and improbe readability.
Signed-off-by: default avatarMarco Felsch <m.felsch@pengutronix.de>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 453b0c83
...@@ -557,33 +557,26 @@ int v4l2_fwnode_endpoint_alloc_parse(struct fwnode_handle *fwnode, ...@@ -557,33 +557,26 @@ int v4l2_fwnode_endpoint_alloc_parse(struct fwnode_handle *fwnode,
} }
EXPORT_SYMBOL_GPL(v4l2_fwnode_endpoint_alloc_parse); EXPORT_SYMBOL_GPL(v4l2_fwnode_endpoint_alloc_parse);
int v4l2_fwnode_parse_link(struct fwnode_handle *__fwnode, int v4l2_fwnode_parse_link(struct fwnode_handle *fwnode,
struct v4l2_fwnode_link *link) struct v4l2_fwnode_link *link)
{ {
const char *port_prop = "reg"; struct fwnode_endpoint fwep;
struct fwnode_handle *fwnode;
memset(link, 0, sizeof(*link)); memset(link, 0, sizeof(*link));
fwnode = fwnode_get_parent(__fwnode); fwnode_graph_parse_endpoint(fwnode, &fwep);
fwnode_property_read_u32(fwnode, port_prop, &link->local_port); link->local_port = fwep.port;
fwnode = fwnode_get_next_parent(fwnode); link->local_node = fwnode_graph_get_port_parent(fwnode);
if (is_of_node(fwnode) && of_node_name_eq(to_of_node(fwnode), "ports"))
fwnode = fwnode_get_next_parent(fwnode);
link->local_node = fwnode;
fwnode = fwnode_graph_get_remote_endpoint(__fwnode); fwnode = fwnode_graph_get_remote_endpoint(fwnode);
if (!fwnode) { if (!fwnode) {
fwnode_handle_put(fwnode); fwnode_handle_put(fwnode);
return -ENOLINK; return -ENOLINK;
} }
fwnode = fwnode_get_parent(fwnode); fwnode_graph_parse_endpoint(fwnode, &fwep);
fwnode_property_read_u32(fwnode, port_prop, &link->remote_port); link->remote_port = fwep.port;
fwnode = fwnode_get_next_parent(fwnode); link->remote_node = fwnode_graph_get_port_parent(fwnode);
if (is_of_node(fwnode) && of_node_name_eq(to_of_node(fwnode), "ports"))
fwnode = fwnode_get_next_parent(fwnode);
link->remote_node = fwnode;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment