[U-Boot] [RFC PATCH 2/4 v1] fdt_decode: make more available.

Simon Glass sjg at chromium.org
Thu Sep 15 21:18:00 CEST 2011


Hi Jason,

On Thu, Sep 15, 2011 at 6:54 AM, Jason Cooper <u-boot at lakedaemon.net> wrote:
>
> Signed-off-by: Jason Cooper <u-boot at lakedaemon.net>
> ---
>  common/fdt_decode.c  |   11 +++++------
>  include/fdt_decode.h |   13 +++++++++++++
>  2 files changed, 18 insertions(+), 6 deletions(-)
>
> diff --git a/common/fdt_decode.c b/common/fdt_decode.c
> index cd7a071..0f13089 100644
> --- a/common/fdt_decode.c
> +++ b/common/fdt_decode.c
> @@ -33,7 +33,7 @@
>  * turn this into a sparse list later, and keeps the ID with the name.
>  */
>  #define COMPAT(id, name) name
> -static const char *compat_names[COMPAT_COUNT] = {
> +const char *compat_names[COMPAT_COUNT] = {
>  };
>
>  /**
> @@ -43,7 +43,7 @@ static const char *compat_names[COMPAT_COUNT] = {
>  * @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 find_alias_node(const void *blob, const char *name)

If we are going to export these (which I agree we must if we are to
move this code into drivers), then it should have the fdt_decode_
prefix.

Perhaps this is too verbose? I would be happy with
fdtdec_find_alias_node() if that sounds better?

>  {
>        const char *path;
>        int alias_node;
> @@ -68,7 +68,7 @@ static int find_alias_node(const void *blob, const char *name)
>  * @param prop_name    name of property to find
>  * @return address, if found, or ADDR_T_NONE if not
>  */
> -static addr_t get_addr(const void *blob, int node, const char *prop_name)
> +addr_t get_addr(const void *blob, int node, const char *prop_name)
>  {
>        const addr_t *cell;
>        int len;
> @@ -91,7 +91,7 @@ static addr_t get_addr(const void *blob, int node, const char *prop_name)
>  * @param default_val  default value to return if the property is not found
>  * @return integer value, if found, or default_val if not
>  */
> -static s32 get_int(const void *blob, int node, const char *prop_name,
> +s32 get_int(const void *blob, int node, const char *prop_name,
>                s32 default_val)
>  {
>        const s32 *cell;
> @@ -115,7 +115,7 @@ static s32 get_int(const void *blob, int node, const char *prop_name,
>  * @param default_val  default value to return if no 'status' property exists
>  * @return integer value 0/1, if found, or default_val if not
>  */
> -static int get_is_enabled(const void *blob, int node, int default_val)
> +int get_is_enabled(const void *blob, int node, int default_val)
>  {
>        const char *cell;
>
> @@ -160,4 +160,3 @@ int fdt_decode_next_alias(const void *blob, const char *name,
>                return err;
>        return err ? -FDT_ERR_MISSING : node;
>  }
> -
> diff --git a/include/fdt_decode.h b/include/fdt_decode.h
> index ba3c15b..4264e3b 100644
> --- a/include/fdt_decode.h
> +++ b/include/fdt_decode.h
> @@ -19,6 +19,8 @@
>  * MA 02111-1307 USA
>  */
>
> +#ifndef _FDT_DECODE_H_
> +#define _FDT_DECODE_H_
>
>  /*
>  * This file contains convenience functions for decoding useful and
> @@ -55,4 +57,15 @@ enum fdt_compat_id {
>        COMPAT_COUNT,
>  };
>
> +int find_alias_node(const void *blob, const char *name);
> +addr_t get_addr(const void *blob, int node, const char *prop_name);
> +s32 get_int(const void *blob, int node, const char *prop_name,
> +       s32 default_val);
> +int get_is_enabled(const void *blob, int node, int default_val);
> +enum fdt_compat_id fdt_decode_lookup(const void *blob, int node);
> +int fdt_decode_next_compatible(const void *blob, int node,
> +               enum fdt_compat_id id);
> +int fdt_decode_next_alias(const void *blob, const char *name,
> +               enum fdt_compat_id id, int *upto);
>
> +#endif
> --
> 1.7.0.4
>
>


More information about the U-Boot mailing list