Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1574467

Re: [PATCH 1/5] of: introduce of_graph_get_remote_node

From Daniel Vetter <daniel@ffwll.ch>
Newsgroups linux.kernel
Subject Re: [PATCH 1/5] of: introduce of_graph_get_remote_node
Date 2017-02-06 10:00 +0100
Message-ID <t7Njs-2A1-11@gated-at.bofh.it> (permalink)
References <t6ZmF-32o-3@gated-at.bofh.it> <t6ZmF-32o-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Feb 03, 2017 at 09:36:31PM -0600, Rob Herring wrote:
> The OF graph API leaves too much of the graph walking to clients when
> in many cases the driver doesn't care about accessing the port or
> endpoint nodes. The drivers typically just want the device connected via
> a particular graph connection. of_graph_get_remote_node provides this
> functionality.
> 
> Signed-off-by: Rob Herring <robh@kernel.org>

Just a quick procedural comment: drm-misc for 4.11 is closed already, but
if we can get this core patch into 4.11 still then that would avoid
cross-tree sync pains in 4.12 ...
-Daniel

> ---
>  drivers/of/base.c        | 28 ++++++++++++++++++++++++++++
>  include/linux/of_graph.h |  8 ++++++++
>  2 files changed, 36 insertions(+)
> 
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index d4bea3c797d6..ea18ab16b92c 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -2469,3 +2469,31 @@ 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);
> +
> +struct device_node *of_graph_get_remote_node(const struct device_node *node,
> +					     int port, int 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);
> +	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);
> diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h
> index bb3a5a2cd570..7b71d3e09209 100644
> --- a/include/linux/of_graph.h
> +++ b/include/linux/of_graph.h
> @@ -51,6 +51,8 @@ struct device_node *of_graph_get_endpoint_by_regs(
>  struct device_node *of_graph_get_remote_port_parent(
>  					const struct device_node *node);
>  struct device_node *of_graph_get_remote_port(const struct device_node *node);
> +struct device_node *of_graph_get_remote_node(const struct device_node *node,
> +					     int port, int endpoint);
>  #else
>  
>  static inline int of_graph_parse_endpoint(const struct device_node *node,
> @@ -89,6 +91,12 @@ static inline struct device_node *of_graph_get_remote_port(
>  {
>  	return NULL;
>  }
> +static inline struct device_node *of_graph_get_remote_node(
> +					const struct device_node *node,
> +					int port, int endpoint)
> +{
> +	return NULL;
> +}
>  
>  #endif /* CONFIG_OF */
>  
> -- 
> 2.10.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/5] DRM OF graph clean-up Rob Herring <robh@kernel.org> - 2017-02-04 04:40 +0100
  [PATCH 2/5] drm: of: introduce drm_of_find_panel_or_bridge Rob Herring <robh@kernel.org> - 2017-02-04 04:40 +0100
    Re: [PATCH 2/5] drm: of: introduce drm_of_find_panel_or_bridge Liviu Dudau <liviu.dudau@arm.com> - 2017-02-06 11:20 +0100
      Re: [PATCH 2/5] drm: of: introduce drm_of_find_panel_or_bridge Rob Herring <robh@kernel.org> - 2017-02-06 17:30 +0100
    Re: [PATCH 2/5] drm: of: introduce drm_of_find_panel_or_bridge Philipp Zabel <p.zabel@pengutronix.de> - 2017-02-06 11:50 +0100
      Re: [PATCH 2/5] drm: of: introduce drm_of_find_panel_or_bridge Rob Herring <robh@kernel.org> - 2017-02-06 18:00 +0100
        Re: [PATCH 2/5] drm: of: introduce drm_of_find_panel_or_bridge Philipp Zabel <p.zabel@pengutronix.de> - 2017-02-06 18:50 +0100
    Re: [PATCH 2/5] drm: of: introduce drm_of_find_panel_or_bridge Frank Rowand <frowand.list@gmail.com> - 2017-02-10 21:00 +0100
  [PATCH 1/5] of: introduce of_graph_get_remote_node Rob Herring <robh@kernel.org> - 2017-02-04 04:40 +0100
    Re: [PATCH 1/5] of: introduce of_graph_get_remote_node Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com> - 2017-02-04 17:20 +0100
    Re: [PATCH 1/5] of: introduce of_graph_get_remote_node Daniel Vetter <daniel@ffwll.ch> - 2017-02-06 10:00 +0100
      Re: [PATCH 1/5] of: introduce of_graph_get_remote_node Rob Herring <robh@kernel.org> - 2017-02-06 14:50 +0100
    Re: [PATCH 1/5] of: introduce of_graph_get_remote_node Philipp Zabel <p.zabel@pengutronix.de> - 2017-02-06 11:40 +0100
      Re: [PATCH 1/5] of: introduce of_graph_get_remote_node Rob Herring <robh@kernel.org> - 2017-02-06 15:00 +0100
        Re: [PATCH 1/5] of: introduce of_graph_get_remote_node Philipp Zabel <p.zabel@pengutronix.de> - 2017-02-06 15:10 +0100
  [PATCH 5/5] drm: omap: use common OF graph helpers Rob Herring <robh@kernel.org> - 2017-02-04 04:40 +0100
  Re: [PATCH 0/5] DRM OF graph clean-up Russell King - ARM Linux <linux@armlinux.org.uk> - 2017-02-04 11:50 +0100

csiph-web