From: Kuninori Morimoto <kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
To: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Linux-ALSA <alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org>,
Liam Girdwood <lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Simon <horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>,
Laurent
<laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>,
Guennadi <g.liakhovetski-Mmb7MZpHnFY@public.gmane.org>,
Grant Likely
<grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Frank Rowand
<frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Linux-DT <devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Linux-Kernel
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: [PATCH v4 05/12] of_graph: add of_graph_get_port/endpoint_count()
Date: Wed, 16 Nov 2016 02:19:50 +0000 [thread overview]
Message-ID: <87inrow4j9.wl%kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <87polww4o2.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
From: Kuninori Morimoto <kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
OF graph want to count its port/endpoint number, same as
of_get_child_count(). This patch adds these functions.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
---
v3 -> v4
- no change
drivers/of/base.c | 24 ++++++++++++++++++++++++
include/linux/of_graph.h | 8 ++++++++
2 files changed, 32 insertions(+)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index b11f533..e795d0f 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2584,3 +2584,27 @@ 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);
+
+int of_graph_get_port_count(const struct device_node *np)
+{
+ struct device_node *port;
+ int num = 0;
+
+ for_each_of_port(np, port)
+ num++;
+
+ return num;
+}
+EXPORT_SYMBOL(of_graph_get_port_count);
+
+int of_graph_get_endpoint_count(const struct device_node *np)
+{
+ struct device_node *port, *endpoint;
+ int num = 0;
+
+ for_each_of_endpoint(np, port, endpoint)
+ num++;
+
+ return num;
+}
+EXPORT_SYMBOL(of_graph_get_endpoint_count);
diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h
index 8207631..9089459 100644
--- a/include/linux/of_graph.h
+++ b/include/linux/of_graph.h
@@ -54,6 +54,8 @@ struct of_endpoint {
#ifdef CONFIG_OF
int of_graph_parse_endpoint(const struct device_node *node,
struct of_endpoint *endpoint);
+int of_graph_get_port_count(const struct device_node *np);
+int of_graph_get_endpoint_count(const struct device_node *np);
struct device_node *of_graph_get_port_by_id(struct device_node *node, u32 id);
struct device_node *of_graph_get_top_port(struct device *dev);
struct device_node *of_graph_get_next_port(const struct device_node *parent,
@@ -79,6 +81,12 @@ static inline int of_graph_parse_endpoint(const struct device_node *node,
return -ENOSYS;
}
+static inline int of_graph_get_endpoint_count(const struct device_node *np,
+ char *type)
+{
+ return 0;
+}
+
static inline struct device_node *of_graph_get_port_by_id(
struct device_node *node, u32 id)
{
--
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
next prev parent reply other threads:[~2016-11-16 2:19 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-16 2:16 [PATCH v4 00/12] ASoC: add OF graph base simple-card Kuninori Morimoto
2016-11-16 2:18 ` [PATCH v4 02/12] of_graph: add of_graph_get_port_parent() Kuninori Morimoto
[not found] ` <87polww4o2.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2016-11-16 2:18 ` [PATCH v4 01/12] of_graph: add of_graph_get_remote_endpoint() Kuninori Morimoto
2016-11-16 2:19 ` [PATCH v4 03/12] of_graph: add of_graph_get_top_port() Kuninori Morimoto
2016-11-16 2:19 ` [PATCH v4 04/12] of_graph: add for_each_of_port() / for_each_of_endpoint_in_port() Kuninori Morimoto
2016-11-16 2:19 ` Kuninori Morimoto [this message]
2016-11-16 2:20 ` [PATCH v4 06/12] ASoC: simple-card-utils: add asoc_simple_card_parse_graph_dai() Kuninori Morimoto
2016-11-16 2:20 ` [PATCH v4 07/12] ASoC: simple-card-utils: add asoc_simple_card_try_to_probe_graph_card() Kuninori Morimoto
2016-11-16 2:21 ` [PATCH v4 08/12] ASoC: simple-card-utils: adjust for graph on asoc_simple_card_parse_card_name Kuninori Morimoto
2016-11-16 2:21 ` [PATCH v4 09/12] ASoC: add simple-graph-card document Kuninori Morimoto
2016-11-16 2:22 ` [PATCH v4 11/12] ASoC: add simple-graph-scu-card document Kuninori Morimoto
2016-11-22 1:15 ` [PATCH v4 00/12] ASoC: add OF graph base simple-card Kuninori Morimoto
2016-11-16 2:22 ` [PATCH v4 10/12] ASoC: add simple-graph-card support Kuninori Morimoto
2016-11-16 2:22 ` [PATCH v4 12/12] ASoC: add simple-graph-scu-card support Kuninori Morimoto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87inrow4j9.wl%kuninori.morimoto.gx@renesas.com \
--to=kuninori.morimoto.gx-zm6kxycvzfbbdgjk7y7tuq@public.gmane.org \
--cc=alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org \
--cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=g.liakhovetski-Mmb7MZpHnFY@public.gmane.org \
--cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org \
--cc=laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org \
--cc=lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).