xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Chen Baozi <baozich@gmail.com>
Cc: Ian Campbell <Ian.Campbell@citrix.com>,
	Xen Developer List <xen-devel@lists.xen.org>
Subject: Re: [PATCH v6 3/6] xen: Introduce a helper to read a u32 property in device tree.
Date: Mon, 12 Aug 2013 16:19:11 +0100	[thread overview]
Message-ID: <5208FCEF.8040908@linaro.org> (raw)
In-Reply-To: <1376014823-28657-4-git-send-email-baozich@gmail.com>

On 08/09/2013 03:20 AM, Chen Baozi wrote:
> Signed-off-by: Chen Baozi <baozich@gmail.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
> ---
>  xen/common/device_tree.c      | 15 +++++++++++++++
>  xen/include/xen/device_tree.h | 11 +++++++++++
>  2 files changed, 26 insertions(+)
> 
> diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
> index 84d704d..a4701eb 100644
> --- a/xen/common/device_tree.c
> +++ b/xen/common/device_tree.c
> @@ -574,6 +574,21 @@ const void *dt_get_property(const struct dt_device_node *np,
>      return pp ? pp->value : NULL;
>  }
>  
> +bool_t dt_property_read_u32(const struct dt_device_node *np,
> +                         const char *name, u32 *out_value)
> +{
> +    u32 len;
> +    const __be32 *val;
> +
> +    val = dt_get_property(np, name, &len);
> +    if ( !val || len > sizeof(*out_value) )
> +        return 0;
> +
> +    *out_value = be32_to_cpup(val);
> +
> +    return 1;
> +}
> +
>  bool_t dt_device_is_compatible(const struct dt_device_node *device,
>                                 const char *compat)
>  {
> diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h
> index 5a2a5c6..faf727f 100644
> --- a/xen/include/xen/device_tree.h
> +++ b/xen/include/xen/device_tree.h
> @@ -300,6 +300,17 @@ const void *dt_get_property(const struct dt_device_node *np,
>                              const char *name, u32 *lenp);
>  
>  /**
> + * dt_property_read_u32 - Helper to read a u32 property.
> + * @np: node to get the value
> + * @name: name of the property
> + * @out_value: pointer to return value
> + *
> + * Return true if get the desired value.
> + */
> +bool_t dt_property_read_u32(const struct dt_device_node *np,
> +                            const char *name, u32 *out_value);
> +
> +/**
>   * Checks if the given "compat" string matches one of the strings in
>   * the device's "compatible" property
>   */
> 


-- 
Julien Grall

  reply	other threads:[~2013-08-12 15:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-09  2:20 [PATCH v6 0/5] Add UART support and arch timer initialization for OMAP5 Chen Baozi
2013-08-09  2:20 ` [PATCH v6 1/6] xen: rename ns16550-uart.h to 8250-uart.h and fix some typos Chen Baozi
2013-08-09  2:20 ` [PATCH v6 2/6] xen/arm: add 8250 compatible UART support for early_printk Chen Baozi
2013-08-12 15:16   ` Julien Grall
2013-08-13  1:50     ` Chen Baozi
2013-08-09  2:20 ` [PATCH v6 3/6] xen: Introduce a helper to read a u32 property in device tree Chen Baozi
2013-08-12 15:19   ` Julien Grall [this message]
2013-08-12 22:19     ` Julien Grall
2013-08-13  1:32       ` Chen Baozi
2013-08-09  2:20 ` [PATCH v6 4/6] xen/arm: Add the new OMAP UART driver Chen Baozi
2013-08-12 22:21   ` Julien Grall
2013-08-13  2:35     ` Chen Baozi
2013-08-13  9:39       ` Julien Grall
2013-08-13  3:37     ` Chen Baozi
2013-08-13  7:07       ` Chen Baozi
2013-08-09  2:20 ` [PATCH v6 5/6] xen/arm: Add support for device tree specified arch_timer clock frequency Chen Baozi
2013-08-09  2:20 ` [PATCH v6 6/6] xen/arm: Platform recognition and initialize arch_timer for the OMAP5 Chen Baozi

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=5208FCEF.8040908@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=Ian.Campbell@citrix.com \
    --cc=baozich@gmail.com \
    --cc=xen-devel@lists.xen.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;
as well as URLs for NNTP newsgroup(s).