mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH v2 2/8] of_path: add of_find_path_by_phandle()
Date: Tue, 20 Oct 2015 10:39:06 +0200	[thread overview]
Message-ID: <1445330352-30153-3-git-send-email-mkl@pengutronix.de> (raw)
In-Reply-To: <1445330352-30153-1-git-send-email-mkl@pengutronix.de>

This patch adds the function of_find_path_by_phandle(), which is similar to
of_find_path(), but it takes a phandle not a barebox path description.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/of/of_path.c | 22 ++++++++++++++++++++++
 include/of.h         |  1 +
 2 files changed, 23 insertions(+)

diff --git a/drivers/of/of_path.c b/drivers/of/of_path.c
index b3ef26c6a50d..dae7eb628acb 100644
--- a/drivers/of/of_path.c
+++ b/drivers/of/of_path.c
@@ -149,6 +149,28 @@ int __of_find_path(struct device_node *node, const char *propname, char **outpat
 }
 
 /**
+ * of_find_path_by_phandle - translate a phanle in the devicetree to a
+ *                           barebox device path
+ *
+ * @node: the node containing the phandle pointing to the device tree node
+ * @phandle: the phandle pointing to the devicetree node
+ * @outpath: if this function returns 0 outpath will contain the path belonging
+ *           to the input path description. Must be freed with free().
+ * @flags: use OF_FIND_PATH_FLAGS_BB to return the .bb device if available
+ *
+ */
+int of_find_path_by_phandle(struct device_node *node, const char *phandle, char **outpath, unsigned flags)
+{
+	struct device_node *rnode;
+
+	rnode = of_parse_phandle(node, phandle, 0);
+	if (!rnode)
+		return -EINVAL;
+
+	return __of_find_path(rnode, NULL, outpath, flags);
+}
+
+/**
  * of_find_path - translate a path description in the devicetree to a barebox
  *                path
  *
diff --git a/include/of.h b/include/of.h
index e0ebc39b742d..c1c17e70b389 100644
--- a/include/of.h
+++ b/include/of.h
@@ -246,6 +246,7 @@ void of_add_memory_bank(struct device_node *node, bool dump, int r,
 struct device_d *of_find_device_by_node_path(const char *path);
 #define OF_FIND_PATH_FLAGS_BB 1		/* return .bb device if available */
 int of_find_path(struct device_node *node, const char *propname, char **outpath, unsigned flags);
+int of_find_path_by_phandle(struct device_node *node, const char *phandle, char **outpath, unsigned flags);
 int of_register_fixup(int (*fixup)(struct device_node *, void *), void *context);
 int of_unregister_fixup(int (*fixup)(struct device_node *, void *), void *context);
 struct device_node *of_find_node_by_alias(struct device_node *root,
-- 
2.6.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2015-10-20  8:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-20  8:39 [PATCH v2 1/8] state framework enhancements Marc Kleine-Budde
2015-10-20  8:39 ` [PATCH v2 1/8] of_path: of_find_path() factor out device detection logic into separate function Marc Kleine-Budde
2015-10-21  6:24   ` Sascha Hauer
2015-12-10 22:38   ` Trent Piepho
2015-12-11  0:07     ` [PATCH] of_path: Fix bug with partitions, simply code Trent Piepho
2015-12-11  9:35       ` Sascha Hauer
2015-12-11 18:51         ` Trent Piepho
2015-12-16 10:43       ` Sascha Hauer
2015-10-20  8:39 ` Marc Kleine-Budde [this message]
2015-10-20  8:39 ` [PATCH v2 3/8] state: make use of of_find_path_by_phandle() and add return -EPROBE_DEFER if device is not available Marc Kleine-Budde
2015-10-20  8:39 ` [PATCH v2 4/8] state: use name of device node as name if alias " Marc Kleine-Budde
2015-10-20  8:39 ` [PATCH v2 5/8] state: disable load command Marc Kleine-Budde
2015-10-20  8:39 ` [PATCH v2 6/8] crypto: add simple keystore Marc Kleine-Budde
2015-10-20  8:39 ` [PATCH v2 7/8] state: prepare raw backend for hmac support Marc Kleine-Budde
2015-10-20  8:39 ` [PATCH v2 8/8] state: backend_raw: add hamc support Marc Kleine-Budde
2015-10-20  9:49   ` Jan Lübbe
2015-10-21  7:13   ` Sascha Hauer
2015-10-21  8:56     ` Marc Kleine-Budde
2015-10-21  9:12       ` Sascha Hauer

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=1445330352-30153-3-git-send-email-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=barebox@lists.infradead.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