diff mbox

[U-Boot] fdt: remove fdtdec_get_alias_node() function

Message ID 1416566828-3776-1-git-send-email-yamada.m@jp.panasonic.com
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Masahiro Yamada Nov. 21, 2014, 10:47 a.m. UTC
The fdt_path_offset() checks an alias too.

fdtdec_get_alias_node(blob, "foo") is equivalent to
fdt_path_offset(blob, "foo").

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---

 drivers/serial/serial-uclass.c |  2 +-
 include/fdtdec.h               | 11 -----------
 lib/fdtdec.c                   | 15 ---------------
 3 files changed, 1 insertion(+), 27 deletions(-)

Comments

Simon Glass Nov. 23, 2014, 10:23 p.m. UTC | #1
On 21 November 2014 at 03:47, Masahiro Yamada <yamada.m@jp.panasonic.com> wrote:
> The fdt_path_offset() checks an alias too.
>
> fdtdec_get_alias_node(blob, "foo") is equivalent to
> fdt_path_offset(blob, "foo").
>
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> ---
>
>  drivers/serial/serial-uclass.c |  2 +-
>  include/fdtdec.h               | 11 -----------
>  lib/fdtdec.c                   | 15 ---------------
>  3 files changed, 1 insertion(+), 27 deletions(-)

Thanks!

Acked-by: Simon Glass <sjg@chromium.org>
Simon Glass Nov. 27, 2014, 4:22 p.m. UTC | #2
Hi Masahiro,

On 23 November 2014 at 15:23, Simon Glass <sjg@chromium.org> wrote:
> On 21 November 2014 at 03:47, Masahiro Yamada <yamada.m@jp.panasonic.com> wrote:
>> The fdt_path_offset() checks an alias too.
>>
>> fdtdec_get_alias_node(blob, "foo") is equivalent to
>> fdt_path_offset(blob, "foo").
>>
>> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
>> ---
>>
>>  drivers/serial/serial-uclass.c |  2 +-
>>  include/fdtdec.h               | 11 -----------
>>  lib/fdtdec.c                   | 15 ---------------
>>  3 files changed, 1 insertion(+), 27 deletions(-)
>
> Thanks!
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-fdt, thanks!

In case you are interested, these was added and removed before:

added: b5220bc fdt: add decode helper library
removed: 0087847 fdt: Remove fdtdec_find_alias_node() function
added: 3234aa4 fdt: Add a function to get the node offset of an alias

All three commits were written by me. Given that track record I will
be due to add it again in 2016.

Regards,
Simon
Masahiro Yamada Nov. 28, 2014, 1:35 a.m. UTC | #3
Hi Simon,


On Thu, 27 Nov 2014 09:22:10 -0700
Simon Glass <sjg@chromium.org> wrote:

> Hi Masahiro,
> 
> On 23 November 2014 at 15:23, Simon Glass <sjg@chromium.org> wrote:
> > On 21 November 2014 at 03:47, Masahiro Yamada <yamada.m@jp.panasonic.com> wrote:
> >> The fdt_path_offset() checks an alias too.
> >>
> >> fdtdec_get_alias_node(blob, "foo") is equivalent to
> >> fdt_path_offset(blob, "foo").
> >>
> >> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> >> ---
> >>
> >>  drivers/serial/serial-uclass.c |  2 +-
> >>  include/fdtdec.h               | 11 -----------
> >>  lib/fdtdec.c                   | 15 ---------------
> >>  3 files changed, 1 insertion(+), 27 deletions(-)
> >
> > Thanks!
> >
> > Acked-by: Simon Glass <sjg@chromium.org>
> 
> Applied to u-boot-fdt, thanks!
> 
> In case you are interested, these was added and removed before:
> 
> added: b5220bc fdt: add decode helper library
> removed: 0087847 fdt: Remove fdtdec_find_alias_node() function
> added: 3234aa4 fdt: Add a function to get the node offset of an alias
> 
> All three commits were written by me. Given that track record I will
> be due to add it again in 2016.

Oh dear, and then I will be due to remove it again in 2018.


Best Regards
Masahiro Yamada
diff mbox

Patch

diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index 71f1a5c..28dccfa 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -34,7 +34,7 @@  static void serial_find_console_or_panic(void)
 	/* Check for a chosen console */
 	node = fdtdec_get_chosen_node(gd->fdt_blob, "stdout-path");
 	if (node < 0)
-		node = fdtdec_get_alias_node(gd->fdt_blob, "console");
+		node = fdt_path_offset(gd->fdt_blob, "console");
 	if (!uclass_get_device_by_of_offset(UCLASS_SERIAL, node, &cur_dev))
 		return;
 
diff --git a/include/fdtdec.h b/include/fdtdec.h
index 4ae77be..6e01cce 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -388,17 +388,6 @@  int fdtdec_get_alias_seq(const void *blob, const char *base, int node,
 			 int *seqp);
 
 /**
- * Get the offset of the given alias node
- *
- * This looks up an alias in /aliases then finds the offset of that node.
- *
- * @param blob		Device tree blob (if NULL, then error is returned)
- * @param name		Alias name, e.g. "console"
- * @return Node offset referred to by that alias, or -ve FDT_ERR_...
- */
-int fdtdec_get_alias_node(const void *blob, const char *name);
-
-/**
  * Get the offset of the given chosen node
  *
  * This looks up a property in /chosen containing the path to another node,
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 9714620..2c9d694 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -368,21 +368,6 @@  int fdtdec_get_alias_seq(const void *blob, const char *base, int offset,
 	return -ENOENT;
 }
 
-int fdtdec_get_alias_node(const void *blob, const char *name)
-{
-	const char *prop;
-	int alias_node;
-	int len;
-
-	if (!blob)
-		return -FDT_ERR_NOTFOUND;
-	alias_node = fdt_path_offset(blob, "/aliases");
-	prop = fdt_getprop(blob, alias_node, name, &len);
-	if (!prop)
-		return -FDT_ERR_NOTFOUND;
-	return fdt_path_offset(blob, prop);
-}
-
 int fdtdec_get_chosen_node(const void *blob, const char *name)
 {
 	const char *prop;