提交 6a71d8d7 编写于 作者: K Kieran Bingham 提交者: Rafael J. Wysocki

device property: Add fwnode_graph_get_port_parent

Provide a helper to obtain the parent device fwnode without first
parsing the remote-endpoint as per fwnode_graph_get_remote_port_parent.
Signed-off-by: NKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: NSakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 125ee6b3
...@@ -1170,6 +1170,26 @@ fwnode_graph_get_next_endpoint(struct fwnode_handle *fwnode, ...@@ -1170,6 +1170,26 @@ fwnode_graph_get_next_endpoint(struct fwnode_handle *fwnode,
} }
EXPORT_SYMBOL_GPL(fwnode_graph_get_next_endpoint); EXPORT_SYMBOL_GPL(fwnode_graph_get_next_endpoint);
/**
* fwnode_graph_get_port_parent - Return the device fwnode of a port endpoint
* @endpoint: Endpoint firmware node of the port
*
* Return: the firmware node of the device the @endpoint belongs to.
*/
struct fwnode_handle *
fwnode_graph_get_port_parent(struct fwnode_handle *endpoint)
{
struct fwnode_handle *port, *parent;
port = fwnode_get_parent(endpoint);
parent = fwnode_call_ptr_op(port, graph_get_port_parent);
fwnode_handle_put(port);
return parent;
}
EXPORT_SYMBOL_GPL(fwnode_graph_get_port_parent);
/** /**
* fwnode_graph_get_remote_port_parent - Return fwnode of a remote device * fwnode_graph_get_remote_port_parent - Return fwnode of a remote device
* @fwnode: Endpoint firmware node pointing to the remote endpoint * @fwnode: Endpoint firmware node pointing to the remote endpoint
...@@ -1179,12 +1199,12 @@ EXPORT_SYMBOL_GPL(fwnode_graph_get_next_endpoint); ...@@ -1179,12 +1199,12 @@ EXPORT_SYMBOL_GPL(fwnode_graph_get_next_endpoint);
struct fwnode_handle * struct fwnode_handle *
fwnode_graph_get_remote_port_parent(struct fwnode_handle *fwnode) fwnode_graph_get_remote_port_parent(struct fwnode_handle *fwnode)
{ {
struct fwnode_handle *port, *parent; struct fwnode_handle *endpoint, *parent;
port = fwnode_graph_get_remote_port(fwnode); endpoint = fwnode_graph_get_remote_endpoint(fwnode);
parent = fwnode_call_ptr_op(port, graph_get_port_parent); parent = fwnode_graph_get_port_parent(endpoint);
fwnode_handle_put(port); fwnode_handle_put(endpoint);
return parent; return parent;
} }
......
...@@ -275,6 +275,8 @@ void *device_get_mac_address(struct device *dev, char *addr, int alen); ...@@ -275,6 +275,8 @@ void *device_get_mac_address(struct device *dev, char *addr, int alen);
struct fwnode_handle *fwnode_graph_get_next_endpoint( struct fwnode_handle *fwnode_graph_get_next_endpoint(
struct fwnode_handle *fwnode, struct fwnode_handle *prev); struct fwnode_handle *fwnode, struct fwnode_handle *prev);
struct fwnode_handle *
fwnode_graph_get_port_parent(struct fwnode_handle *fwnode);
struct fwnode_handle *fwnode_graph_get_remote_port_parent( struct fwnode_handle *fwnode_graph_get_remote_port_parent(
struct fwnode_handle *fwnode); struct fwnode_handle *fwnode);
struct fwnode_handle *fwnode_graph_get_remote_port( struct fwnode_handle *fwnode_graph_get_remote_port(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册