From: gvb.uboot at gmail.com <gvb.uboot@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 7/7] libfdt: Add support for using aliases in fdt_path_offset()
Date: Tue, 19 Aug 2008 22:30:38 -0400 [thread overview]
Message-ID: <1219199438-21716-8-git-send-email-gvb.uboot@gmail.com> (raw)
In-Reply-To: <1219199438-21716-1-git-send-email-gvb.uboot@gmail.com>
From: Kumar Gala <galak@kernel.crashing.org>
If the path doesn't start with '/' check to see if it matches some alias
under "/aliases" and substitute the matching alias value in the path
and retry the lookup.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Acked-by: Gerald Van Baren <vanbaren@cideas.com>
---
libfdt/fdt_ro.c | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/libfdt/fdt_ro.c b/libfdt/fdt_ro.c
index d566eba..b09a6e9 100644
--- a/libfdt/fdt_ro.c
+++ b/libfdt/fdt_ro.c
@@ -143,8 +143,25 @@ int fdt_path_offset(const void *fdt, const char *path)
FDT_CHECK_HEADER(fdt);
- if (*path != '/')
- return -FDT_ERR_BADPATH;
+ /* see if we have an alias */
+ if (*path != '/') {
+ const char *q;
+ int aliasoffset = fdt_path_offset(fdt, "/aliases");
+
+ if (aliasoffset < 0)
+ return -FDT_ERR_BADPATH;
+
+ q = strchr(path, '/');
+ if (!q)
+ q = end;
+
+ p = fdt_getprop_namelen(fdt, aliasoffset, path, q - p, NULL);
+ if (!p)
+ return -FDT_ERR_BADPATH;
+ offset = fdt_path_offset(fdt, p);
+
+ p = q;
+ }
while (*p) {
const char *q;
--
1.5.6.3
next prev parent reply other threads:[~2008-08-20 2:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-20 2:30 [U-Boot] [PATCH 0/7] libfdt: Update to resync with dtc/libfdt gvb.uboot at gmail.com
2008-08-20 2:30 ` [U-Boot] [PATCH 1/7] dtc: Enable and fix -Wpointer-arith warnings gvb.uboot at gmail.com
2008-08-20 2:30 ` [U-Boot] [PATCH 2/7] dtc: Enable and fix -Wcast-qual warnings gvb.uboot at gmail.com
2008-08-20 2:30 ` [U-Boot] [PATCH 3/7] libfdt: Increase namespace-pollution paranoia gvb.uboot at gmail.com
2008-08-20 2:30 ` [U-Boot] [PATCH 4/7] libfdt: Improve documentation in libfdt.h gvb.uboot at gmail.com
2008-08-20 2:30 ` [U-Boot] [PATCH 5/7] libfdt: Forgot one function when cleaning the namespace gvb.uboot at gmail.com
2008-08-20 2:30 ` [U-Boot] [PATCH 6/7] libfdt: Implement fdt_get_property_namelen() and fdt_getprop_namelen() gvb.uboot at gmail.com
2008-08-20 2:30 ` gvb.uboot at gmail.com [this message]
2008-08-21 1:45 ` [U-Boot] [PATCH 0/7] libfdt: Update to resync with dtc/libfdt Jerry Van Baren
2008-08-21 1:51 ` David Gibson
2008-08-21 2:08 ` Jerry Van Baren
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=1219199438-21716-8-git-send-email-gvb.uboot@gmail.com \
--to=gvb.uboot@gmail.com \
--cc=u-boot@lists.denx.de \
/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