| Submitter | Simon Glass |
|---|---|
| Date | Oct. 26, 2012, 2:31 a.m. |
| Message ID | <1351218671-15228-6-git-send-email-sjg@chromium.org> |
| Download | mbox | patch |
| Permalink | /patch/194344/ |
| State | Accepted, archived |
| Delegated to: | Jerry Van Baren |
| Headers | show |
Comments
On Thu, Oct 25, 2012 at 07:31:02PM -0700, Simon Glass wrote:
> This function is useful outside fdtdec, so export it.
Hrm. fdt_path_offset() in libfdt itself will already look up aliases
if given a path that doesn't start with '/'. So it's not clear why
you need this function at all.
Hi David, On Thu, Oct 25, 2012 at 9:24 PM, David Gibson <david@gibson.dropbear.id.au> wrote: > On Thu, Oct 25, 2012 at 07:31:02PM -0700, Simon Glass wrote: >> This function is useful outside fdtdec, so export it. > > Hrm. fdt_path_offset() in libfdt itself will already look up aliases > if given a path that doesn't start with '/'. So it's not clear why > you need this function at all. Ahh, well I won't be needing that patch, then. I will submit one to remove this function. Thank you. Regards, Simon > > -- > David Gibson | I'll have my music baroque, and my code > david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ > | _way_ _around_! > http://www.ozlabs.org/~dgibson
Patch
diff --git a/include/fdtdec.h b/include/fdtdec.h index e70714b..e566e47 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -110,6 +110,15 @@ int fdtdec_next_alias(const void *blob, const char *name, enum fdt_compat_id id, int *upto); /** + * Look in the FDT for an alias with the given name and return its node. + * + * @param blob FDT blob + * @param name alias name to look up + * @return node offset if found, or an error code < 0 otherwise + */ +int fdtdec_find_alias_node(const void *blob, const char *name); + +/** * Find the next compatible node for a peripheral. * * Do the first call with node = 0. This function will return a pointer to diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 32f03cc..16435b7 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -59,12 +59,12 @@ const char *fdtdec_get_compatible(enum fdt_compat_id id) * @param name alias name to look up * @return node offset if found, or an error code < 0 otherwise */ -static int find_alias_node(const void *blob, const char *name) +int fdtdec_find_alias_node(const void *blob, const char *name) { const char *path; int alias_node; - debug("find_alias_node: %s\n", name); + debug("%s: %s\n", __func__, name); alias_node = fdt_path_offset(blob, "/aliases"); if (alias_node < 0) return alias_node; @@ -171,7 +171,7 @@ int fdtdec_next_alias(const void *blob, const char *name, /* snprintf() is not available */ assert(strlen(name) < MAX_STR_LEN); sprintf(str, "%.*s%d", MAX_STR_LEN, name, *upto); - node = find_alias_node(blob, str); + node = fdtdec_find_alias_node(blob, str); if (node < 0) return node; err = fdt_node_check_compatible(blob, node, compat_names[id]);
This function is useful outside fdtdec, so export it. Signed-off-by: Simon Glass <sjg@chromium.org> --- include/fdtdec.h | 9 +++++++++ lib/fdtdec.c | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-)