* [PATCH 1/6] of_graph: add of_graph_get_remote_endpoint()
2017-01-19 6:31 [PATCH 0/6] of_graph_get_remote_endpoint() Kuninori Morimoto
@ 2017-01-19 6:34 ` Kuninori Morimoto
[not found] ` <87o9z34l3o.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
` (4 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Kuninori Morimoto @ 2017-01-19 6:34 UTC (permalink / raw)
To: Rob Herring, Frank Rowand
Cc: Linux-Kernel, Linux-DT, Laurent, Tomi Valkeinen, David Airlie,
Sean Paul, Peter Chen, Peter Ujfalusi, Benoit Parrot,
Mauro Carvalho Chehab, Javier Martinez Canillas, Sakari Ailus,
Bartlomiej Zolnierkiewicz
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
It should use same method to get same result.
To getting remote-endpoint node,
let's use of_graph_get_remote_endpoint()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
drivers/of/base.c | 18 ++++++++++++++++--
include/linux/of_graph.h | 8 ++++++++
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index d4bea3c..5391a9b5 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2426,6 +2426,20 @@ struct device_node *of_graph_get_endpoint_by_regs(
EXPORT_SYMBOL(of_graph_get_endpoint_by_regs);
/**
+ * of_graph_get_remote_endpoint() - get remote endpoint node
+ * @node: pointer to a local endpoint device_node
+ *
+ * Return: Remote endpoint node associated with remote endpoint node linked
+ * to @node. Use of_node_put() on it when done.
+ */
+struct device_node *of_graph_get_remote_endpoint(const struct device_node *node)
+{
+ /* Get remote endpoint node. */
+ return of_parse_phandle(node, "remote-endpoint", 0);
+}
+EXPORT_SYMBOL(of_graph_get_remote_endpoint);
+
+/**
* of_graph_get_remote_port_parent() - get remote port's parent node
* @node: pointer to a local endpoint device_node
*
@@ -2439,7 +2453,7 @@ struct device_node *of_graph_get_remote_port_parent(
unsigned int depth;
/* Get remote endpoint node. */
- np = of_parse_phandle(node, "remote-endpoint", 0);
+ np = of_graph_get_remote_endpoint(node);
/* Walk 3 levels up only if there is 'ports' node. */
for (depth = 3; depth && np; depth--) {
@@ -2463,7 +2477,7 @@ struct device_node *of_graph_get_remote_port(const struct device_node *node)
struct device_node *np;
/* Get remote endpoint node. */
- np = of_parse_phandle(node, "remote-endpoint", 0);
+ np = of_graph_get_remote_endpoint(node);
if (!np)
return NULL;
return of_get_next_parent(np);
diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h
index bb3a5a2..d9d6d9c 100644
--- a/include/linux/of_graph.h
+++ b/include/linux/of_graph.h
@@ -48,6 +48,8 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
struct device_node *previous);
struct device_node *of_graph_get_endpoint_by_regs(
const struct device_node *parent, int port_reg, int reg);
+struct device_node *of_graph_get_remote_endpoint(
+ const struct device_node *node);
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);
@@ -78,6 +80,12 @@ static inline struct device_node *of_graph_get_endpoint_by_regs(
return NULL;
}
+static inline struct device_node *of_graph_get_remote_endpoint(
+ const struct device_node *node)
+{
+ return NULL;
+}
+
static inline struct device_node *of_graph_get_remote_port_parent(
const struct device_node *node)
{
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread[parent not found: <87o9z34l3o.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>]
* [PATCH 2/6] drm/omapdrm: use of_graph_get_remote_endpoint()
[not found] ` <87o9z34l3o.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
@ 2017-01-19 6:34 ` Kuninori Morimoto
2017-01-19 6:36 ` Kuninori Morimoto
2017-01-19 6:37 ` [PATCH 4/6] media: ti-vpe: cal: " Kuninori Morimoto
2 siblings, 0 replies; 10+ messages in thread
From: Kuninori Morimoto @ 2017-01-19 6:34 UTC (permalink / raw)
To: Rob Herring, Frank Rowand
Cc: Linux-Kernel, Linux-DT, Laurent, Tomi Valkeinen, David Airlie,
Sean Paul, Peter Chen, Peter Ujfalusi, Benoit Parrot,
Mauro Carvalho Chehab, Javier Martinez Canillas, Sakari Ailus,
Bartlomiej Zolnierkiewicz
From: Kuninori Morimoto <kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
Now, we can use of_graph_get_remote_endpoint(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
---
drivers/gpu/drm/omapdrm/dss/dss-of.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/omapdrm/dss/dss-of.c b/drivers/gpu/drm/omapdrm/dss/dss-of.c
index dfd4e96..f49f2ba 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss-of.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss-of.c
@@ -16,6 +16,7 @@
#include <linux/err.h>
#include <linux/module.h>
#include <linux/of.h>
+#include <linux/of_graph.h>
#include <linux/seq_file.h>
#include "omapdss.h"
@@ -127,7 +128,7 @@ static struct device_node *omapdss_of_get_remote_port(const struct device_node *
{
struct device_node *np;
- np = of_parse_phandle(node, "remote-endpoint", 0);
+ np = of_graph_get_remote_endpoint(node);
if (!np)
return NULL;
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 2/6] drm/omapdrm: use of_graph_get_remote_endpoint()
[not found] ` <87o9z34l3o.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2017-01-19 6:34 ` [PATCH 2/6] drm/omapdrm: use of_graph_get_remote_endpoint() Kuninori Morimoto
@ 2017-01-19 6:36 ` Kuninori Morimoto
2017-01-19 6:37 ` [PATCH 4/6] media: ti-vpe: cal: " Kuninori Morimoto
2 siblings, 0 replies; 10+ messages in thread
From: Kuninori Morimoto @ 2017-01-19 6:36 UTC (permalink / raw)
To: Rob Herring, Frank Rowand
Cc: Linux-Kernel, Linux-DT, Laurent, Tomi Valkeinen, David Airlie,
Sean Paul, Peter Chen, Peter Ujfalusi, Benoit Parrot,
Mauro Carvalho Chehab, Javier Martinez Canillas, Sakari Ailus,
Bartlomiej Zolnierkiewicz
From: Kuninori Morimoto <kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
Now, we can use of_graph_get_remote_endpoint(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
---
drivers/gpu/drm/omapdrm/dss/dss-of.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/omapdrm/dss/dss-of.c b/drivers/gpu/drm/omapdrm/dss/dss-of.c
index dfd4e96..f49f2ba 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss-of.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss-of.c
@@ -16,6 +16,7 @@
#include <linux/err.h>
#include <linux/module.h>
#include <linux/of.h>
+#include <linux/of_graph.h>
#include <linux/seq_file.h>
#include "omapdss.h"
@@ -127,7 +128,7 @@ static struct device_node *omapdss_of_get_remote_port(const struct device_node *
{
struct device_node *np;
- np = of_parse_phandle(node, "remote-endpoint", 0);
+ np = of_graph_get_remote_endpoint(node);
if (!np)
return NULL;
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 4/6] media: ti-vpe: cal: use of_graph_get_remote_endpoint()
[not found] ` <87o9z34l3o.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2017-01-19 6:34 ` [PATCH 2/6] drm/omapdrm: use of_graph_get_remote_endpoint() Kuninori Morimoto
2017-01-19 6:36 ` Kuninori Morimoto
@ 2017-01-19 6:37 ` Kuninori Morimoto
2 siblings, 0 replies; 10+ messages in thread
From: Kuninori Morimoto @ 2017-01-19 6:37 UTC (permalink / raw)
To: Rob Herring, Frank Rowand
Cc: Linux-Kernel, Linux-DT, Laurent, Tomi Valkeinen, David Airlie,
Sean Paul, Peter Chen, Peter Ujfalusi, Benoit Parrot,
Mauro Carvalho Chehab, Javier Martinez Canillas, Sakari Ailus,
Bartlomiej Zolnierkiewicz
From: Kuninori Morimoto <kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
Now, we can use of_graph_get_remote_endpoint(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
---
drivers/media/platform/ti-vpe/cal.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c
index 7a058b6..ebf11b4 100644
--- a/drivers/media/platform/ti-vpe/cal.c
+++ b/drivers/media/platform/ti-vpe/cal.c
@@ -1701,7 +1701,7 @@ static int of_cal_create_instance(struct cal_ctx *ctx, int inst)
asd->match_type = V4L2_ASYNC_MATCH_OF;
asd->match.of.node = sensor_node;
- remote_ep = of_parse_phandle(ep_node, "remote-endpoint", 0);
+ remote_ep = of_graph_get_remote_endpoint(ep_node);
if (!remote_ep) {
ctx_dbg(3, ctx, "can't get remote-endpoint\n");
goto cleanup_exit;
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/6] drm: rcar-du: use of_graph_get_remote_endpoint()
2017-01-19 6:31 [PATCH 0/6] of_graph_get_remote_endpoint() Kuninori Morimoto
2017-01-19 6:34 ` [PATCH 1/6] of_graph: add of_graph_get_remote_endpoint() Kuninori Morimoto
[not found] ` <87o9z34l3o.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
@ 2017-01-19 6:36 ` Kuninori Morimoto
2017-01-19 6:37 ` [PATCH 5/6] v4l: of: " Kuninori Morimoto
` (2 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Kuninori Morimoto @ 2017-01-19 6:36 UTC (permalink / raw)
To: Rob Herring, Frank Rowand
Cc: Linux-Kernel, Linux-DT, Laurent, Tomi Valkeinen, David Airlie,
Sean Paul, Peter Chen, Peter Ujfalusi, Benoit Parrot,
Mauro Carvalho Chehab, Javier Martinez Canillas, Sakari Ailus,
Bartlomiej Zolnierkiewicz
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Now, we can use of_graph_get_remote_endpoint(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
index 7a6bd8b..2ba728b 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
@@ -391,7 +391,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
return -ENODEV;
}
- entity_ep_node = of_parse_phandle(ep->local_node, "remote-endpoint", 0);
+ entity_ep_node = of_graph_get_remote_endpoint(ep->local_node);
for_each_endpoint_of_node(entity, ep_node) {
if (ep_node == entity_ep_node)
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 5/6] v4l: of: use of_graph_get_remote_endpoint()
2017-01-19 6:31 [PATCH 0/6] of_graph_get_remote_endpoint() Kuninori Morimoto
` (2 preceding siblings ...)
2017-01-19 6:36 ` [PATCH 3/6] drm: rcar-du: " Kuninori Morimoto
@ 2017-01-19 6:37 ` Kuninori Morimoto
2017-01-19 6:38 ` [PATCH 6/6] omapfb: " Kuninori Morimoto
2017-01-19 14:34 ` [PATCH 0/6] of_graph_get_remote_endpoint() Rob Herring
5 siblings, 0 replies; 10+ messages in thread
From: Kuninori Morimoto @ 2017-01-19 6:37 UTC (permalink / raw)
To: Rob Herring, Frank Rowand
Cc: Linux-Kernel, Linux-DT, Laurent, Tomi Valkeinen, David Airlie,
Sean Paul, Peter Chen, Peter Ujfalusi, Benoit Parrot,
Mauro Carvalho Chehab, Javier Martinez Canillas, Sakari Ailus,
Bartlomiej Zolnierkiewicz
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Now, we can use of_graph_get_remote_endpoint(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
drivers/media/v4l2-core/v4l2-of.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/media/v4l2-core/v4l2-of.c b/drivers/media/v4l2-core/v4l2-of.c
index 93b3368..b2ed4b3 100644
--- a/drivers/media/v4l2-core/v4l2-of.c
+++ b/drivers/media/v4l2-core/v4l2-of.c
@@ -14,6 +14,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
+#include <linux/of_graph.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/types.h>
@@ -284,7 +285,7 @@ int v4l2_of_parse_link(const struct device_node *node,
np = of_get_next_parent(np);
link->local_node = np;
- np = of_parse_phandle(node, "remote-endpoint", 0);
+ np = of_graph_get_remote_endpoint(node);
if (!np) {
of_node_put(link->local_node);
return -ENOLINK;
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 6/6] omapfb: use of_graph_get_remote_endpoint()
2017-01-19 6:31 [PATCH 0/6] of_graph_get_remote_endpoint() Kuninori Morimoto
` (3 preceding siblings ...)
2017-01-19 6:37 ` [PATCH 5/6] v4l: of: " Kuninori Morimoto
@ 2017-01-19 6:38 ` Kuninori Morimoto
2017-01-19 14:34 ` [PATCH 0/6] of_graph_get_remote_endpoint() Rob Herring
5 siblings, 0 replies; 10+ messages in thread
From: Kuninori Morimoto @ 2017-01-19 6:38 UTC (permalink / raw)
To: Rob Herring, Frank Rowand
Cc: Linux-Kernel, Linux-DT, Laurent, Tomi Valkeinen, David Airlie,
Sean Paul, Peter Chen, Peter Ujfalusi, Benoit Parrot,
Mauro Carvalho Chehab, Javier Martinez Canillas, Sakari Ailus,
Bartlomiej Zolnierkiewicz
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Now, we can use of_graph_get_remote_endpoint(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
drivers/video/fbdev/omap2/omapfb/dss/dss-of.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c b/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c
index d356a25..f1eb8b0 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c
@@ -16,6 +16,7 @@
#include <linux/err.h>
#include <linux/module.h>
#include <linux/of.h>
+#include <linux/of_graph.h>
#include <linux/seq_file.h>
#include <video/omapfb_dss.h>
@@ -128,7 +129,7 @@ static struct device_node *omapdss_of_get_remote_port(const struct device_node *
{
struct device_node *np;
- np = of_parse_phandle(node, "remote-endpoint", 0);
+ np = of_graph_get_remote_endpoint(node);
if (!np)
return NULL;
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH 0/6] of_graph_get_remote_endpoint()
2017-01-19 6:31 [PATCH 0/6] of_graph_get_remote_endpoint() Kuninori Morimoto
` (4 preceding siblings ...)
2017-01-19 6:38 ` [PATCH 6/6] omapfb: " Kuninori Morimoto
@ 2017-01-19 14:34 ` Rob Herring
[not found] ` <CAL_JsqJEL4jd2gnoC+mygJzuEgPO8H4PQhN5dvmq_rN1mBfVEw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
5 siblings, 1 reply; 10+ messages in thread
From: Rob Herring @ 2017-01-19 14:34 UTC (permalink / raw)
To: Kuninori Morimoto
Cc: Frank Rowand, Linux-Kernel, Linux-DT, Laurent, Tomi Valkeinen,
David Airlie, Sean Paul, Peter Chen, Peter Ujfalusi,
Benoit Parrot, Mauro Carvalho Chehab, Javier Martinez Canillas,
Sakari Ailus, Bartlomiej Zolnierkiewicz
On Thu, Jan 19, 2017 at 12:31 AM, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
>
>
>
> Hi Rob
>
> Now many driver is getting remote-endpoint by manually,
> but we should use same method to get same result IMO.
> Thus this patch adds of_graph_get_remote_endpoint() for this purpose.
> And use it on several drivers
This looks okay, but I think we need to be improving the graph api at
a higher level. Each user seems to be doing too much open coding of
walking of the graph. The user typically just wants the remote node
parent of a given port and endpoint number. Why does the user walk the
graph to find the endpoint node, then parse remote-endpoint, then walk
up parents. We have lots of other graph users and you didn't need to
update them which means they are already using helpers. Maybe the
drivers here need to be fixed. omapfb in particular looks like it
duplicates a bunch of helpers we already have, but maybe we're close
to removing that driver.
Rob
^ permalink raw reply [flat|nested] 10+ messages in thread