[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170206085023.onmsh5dcmn6ofpp5@phenom.ffwll.local>
Date: Mon, 6 Feb 2017 09:50:23 +0100
From: Daniel Vetter <daniel@...ll.ch>
To: Rob Herring <robh@...nel.org>
Cc: David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel.vetter@...el.com>,
Sean Paul <seanpaul@...omium.org>,
Neil Armstrong <narmstrong@...libre.com>,
Liviu Dudau <liviu.dudau@....com>,
dri-devel@...ts.freedesktop.org,
Tomi Valkeinen <tomi.valkeinen@...com>,
Frank Rowand <frowand.list@...il.com>,
Marek Vasut <marex@...x.de>,
Kevin Hilman <khilman@...libre.com>,
Chen-Yu Tsai <wens@...e.org>,
Krzysztof Kozlowski <krzk@...nel.org>,
Xinliang Liu <z.liuxinliang@...ilicon.com>,
Javier Martinez Canillas <javier@....samsung.com>,
Xinwei Kong <kong.kongxinwei@...ilicon.com>,
Kukjin Kim <kgene@...nel.org>,
Mali DP Maintainers <malidp@...s.arm.com>,
devicetree@...r.kernel.org, Chen Feng <puck.chen@...ilicon.com>,
Jyri Sarha <jsarha@...com>, Carlo Caione <carlo@...one.org>,
Russell King <rmk+kernel@...linux.org.uk>,
Matthias Brugger <matthias.bgg@...il.com>,
Alison Wang <alison.wang@...escale.com>,
Jingoo Han <jingoohan1@...il.com>,
Seung-Woo Kim <sw0312.kim@...sung.com>,
linux-kernel@...r.kernel.org,
Kyungmin Park <kyungmin.park@...sung.com>,
Rongrong Zou <zourongrong@...il.com>,
Maxime Ripard <maxime.ripard@...e-electrons.com>
Subject: Re: [PATCH 1/5] of: introduce of_graph_get_remote_node
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@...nel.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@...ts.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Powered by blists - more mailing lists