diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-22 19:23:14 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-22 19:23:14 -0800 |
commit | be5165a51d2500ae1afa1236a8b09858831fdf7e (patch) | |
tree | fde7b0072523dce999c74bd243f8b78f3efb5034 /drivers/of/base.c | |
parent | c1aac62f36c1e37ee81c9e09ee9ee733eef05dcb (diff) | |
parent | 4e29ccdb240ec833f172a34fcf405e077b51066b (diff) | |
download | linux-be5165a51d2500ae1afa1236a8b09858831fdf7e.tar.bz2 |
Merge tag 'devicetree-for-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux
Pull DeviceTree updates from Rob Herring:
"Pretty standard stuff with dtc upstream sync being the biggest piece.
- Sync dtc to upstream commit 0931cea3ba20. This picks up overlay
support in dtc.
- Set dma_ops for reserved memory users.
- Make references to IOMMU consistent in DT bindings.
- Cleanup references to pm_power_off in bindings.
- Move some display bindings that snuck into the old bindings/video/
path.
- Fix some wrong documentation paths caused from binding
restructuring.
- Vendor prefixes for Faraday and Fujitsu.
- Fix an of_node ref counting leak in of_find_node_opts_by_path
- Introduce new graph helper of_graph_get_remote_node() which will be
used by DRM drivers in 4.12"
* tag 'devicetree-for-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (27 commits)
DT: add Faraday Tec. as vendor
of: introduce of_graph_get_remote_node
of: Add missing space at end of pr_fmt().
of: make of_device_make_bus_id() static
of: fix of_node leak caused in of_find_node_opts_by_path
dt-bindings: net: remove reference to fixed link support
dt-bindings: power: reset: qnap-poweroff: Drop reference to pm_power_off
dt-bindings: power: reset: gpio-poweroff: Drop reference to pm_power_off
dt-bindings: mfd: as3722: Drop reference to pm_power_off
dt-bindings: display: move ANX7814 and SiI8620 bridge bindings
of/unittest: Swap arguments of of_unittest_apply_overlay()
Documentation: usb: fix wrong documentation paths
serial: fsl-imx-uart.txt: Remove generic property
devicetree: Add Fujitsu Ltd. vendor prefix
Documentation: display: fix wrong documentation paths
of: remove redundant memset in overlay
bus:qcom : Fix typo in qcom,ebi2.txt
dt-bindings: qman: Remove pool channel node
Documentation: panel-dpi: fix path to display-timing.txt
devicetree: bindings: clk: mvebu: fix description for sata1 on Armada XP
...
Diffstat (limited to 'drivers/of/base.c')
-rw-r--r-- | drivers/of/base.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index a88387bc0ac1..d7c4629a3a2d 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -843,8 +843,11 @@ struct device_node *of_find_node_opts_by_path(const char *path, const char **opt if (!np) np = of_node_get(of_root); while (np && *path == '/') { + struct device_node *tmp = np; + path++; /* Increment past '/' delimiter */ np = __of_find_node_by_path(np, path); + of_node_put(tmp); path = strchrnul(path, '/'); if (separator && separator < path) break; @@ -2495,3 +2498,40 @@ struct device_node *of_graph_get_remote_port(const struct device_node *node) return of_get_next_parent(np); } EXPORT_SYMBOL(of_graph_get_remote_port); + +/** + * of_graph_get_remote_node() - get remote parent device_node for given port/endpoint + * @node: pointer to parent device_node containing graph port/endpoint + * @port: identifier (value of reg property) of the parent port node + * @endpoint: identifier (value of reg property) of the endpoint node + * + * Return: Remote device node associated with remote endpoint node linked + * to @node. Use of_node_put() on it when done. + */ +struct device_node *of_graph_get_remote_node(const struct device_node *node, + u32 port, u32 endpoint) +{ + struct device_node *endpoint_node, *remote; + + endpoint_node = of_graph_get_endpoint_by_regs(node, port, endpoint); + if (!endpoint_node) { + pr_debug("no valid endpoint (%d, %d) for node %s\n", + port, endpoint, node->full_name); + return NULL; + } + + remote = of_graph_get_remote_port_parent(endpoint_node); + of_node_put(endpoint_node); + if (!remote) { + pr_debug("no valid remote node\n"); + return NULL; + } + + if (!of_device_is_available(remote)) { + pr_debug("not available for remote node\n"); + return NULL; + } + + return remote; +} +EXPORT_SYMBOL(of_graph_get_remote_node); |