mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 5/7] of: Add of_alias_get function
Date: Mon, 27 May 2013 10:52:53 +0200	[thread overview]
Message-ID: <1369644775-29887-6-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1369644775-29887-1-git-send-email-s.hauer@pengutronix.de>

This is used to retrieve the name of the alias for a given
devicenode.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/of/base.c | 13 +++++++++++++
 include/of.h      |  6 ++++++
 2 files changed, 19 insertions(+)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index e2a8bb5..b58a19b 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -212,6 +212,19 @@ int of_alias_get_id(struct device_node *np, const char *stem)
 }
 EXPORT_SYMBOL_GPL(of_alias_get_id);
 
+const char *of_alias_get(struct device_node *np)
+{
+	struct property *pp;
+
+	list_for_each_entry(pp, &of_aliases->properties, list) {
+		if (!strcmp(np->full_name, pp->value))
+			return pp->name;
+	}
+
+	return NULL;
+}
+EXPORT_SYMBOL_GPL(of_alias_get);
+
 u64 of_translate_address(struct device_node *node, const __be32 *in_addr)
 {
 	struct property *p;
diff --git a/include/of.h b/include/of.h
index a804ec4..6c75cbd 100644
--- a/include/of.h
+++ b/include/of.h
@@ -178,6 +178,7 @@ struct cdev;
 int of_parse_partitions(struct cdev *cdev, struct device_node *node);
 
 int of_alias_get_id(struct device_node *np, const char *stem);
+const char *of_alias_get(struct device_node *np);
 int of_device_is_stdout_path(struct device_d *dev);
 const char *of_get_model(void);
 void *of_flatten_dtb(struct device_node *node);
@@ -197,6 +198,11 @@ static inline int of_alias_get_id(struct device_node *np, const char *stem)
 	return -ENOENT;
 }
 
+static inline const char *of_alias_get(struct device_node *np)
+{
+	return NULL;
+}
+
 static inline int of_device_is_stdout_path(struct device_d *dev)
 {
 	return 0;
-- 
1.8.2.rc2


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

  parent reply	other threads:[~2013-05-27  8:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-27  8:52 [PATCH] MCI patches Sascha Hauer
2013-05-27  8:52 ` [PATCH 1/7] driver: Attach info callback to device, not to driver Sascha Hauer
2013-05-27  8:52 ` [PATCH 2/7] mci: make mci device a pure device Sascha Hauer
2013-05-27  8:52 ` [PATCH 3/7] mci: embed mci device into struct mci Sascha Hauer
2013-05-27  8:52 ` [PATCH 4/7] mci: set name of mci device to same name as the filename Sascha Hauer
2013-05-27  8:52 ` Sascha Hauer [this message]
2013-05-27  8:52 ` [PATCH 6/7] mci: imx-esdhc: allow to specify devicename via OF alias Sascha Hauer
2013-05-27  8:52 ` [PATCH 7/7] ARM: i.MX51: Add aliases for MMC controllers 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=1369644775-29887-6-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@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