summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham+renesas@ideasonboard.com>2017-06-06 12:37:41 +0300
committerTao Huang <huangtao@rock-chips.com>2017-11-27 14:12:20 +0800
commitc36f8b2d07a42a54ca0d016df39cf2592b6838dc (patch)
tree44a2fc8de394a10da7b247224007ef677d2a06dc /drivers/base
parentc1aa3cab9b3b518b250b298ea5800a692eae0654 (diff)
UPSTREAM: 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: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> (cherry picked from commit 6a71d8d77795e0f7d887baa95bfc0d1d2bc74899) Signed-off-by: Brian J Lovin <brian.j.lovin@intel.com> BUG=b:64133998 TEST=media device topology shows subdevs registered successfully TEST=no camera regression Change-Id: I58c0cfd2759aa62ada3d54cfb77f449ff8a0abc3 Reviewed-on: https://chromium-review.googlesource.com/693680 Commit-Ready: Tomasz Figa <tfiga@chromium.org> Tested-by: Hyungwoo Yang <hyungwoo.yang@intel.com> Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/property.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/drivers/base/property.c b/drivers/base/property.c
index 803b878b66f0..4e105096c47e 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -1098,6 +1098,26 @@ fwnode_graph_get_next_endpoint(struct fwnode_handle *fwnode,
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: Endpoint firmware node pointing to the remote endpoint
*
@@ -1106,12 +1126,12 @@ EXPORT_SYMBOL_GPL(fwnode_graph_get_next_endpoint);
struct fwnode_handle *
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);
- parent = fwnode_call_ptr_op(port, graph_get_port_parent);
+ endpoint = fwnode_graph_get_remote_endpoint(fwnode);
+ parent = fwnode_graph_get_port_parent(endpoint);
- fwnode_handle_put(port);
+ fwnode_handle_put(endpoint);
return parent;
}