From: Julien Grall <julien.grall@linaro.org>
To: Frediano Ziglio <frediano.ziglio@huawei.com>,
Ian Campbell <ian.campbell@citrix.com>,
Stefano Stabellini <stefano.stabellini@citrix.com>,
Tim Deegan <tim@xen.org>
Cc: Zoltan Kiss <zoltan.kiss@linaro.org>,
zoltan.kiss@huawei.com, xen-devel@lists.xen.org
Subject: Re: [PATCH 09/10] xen/device_tree: Add new helper to read arrays from a DTB
Date: Mon, 03 Nov 2014 14:14:21 +0000 [thread overview]
Message-ID: <54578DBD.2040002@linaro.org> (raw)
In-Reply-To: <1415009522-6344-10-git-send-email-frediano.ziglio@huawei.com>
Hi Frediano,
On 11/03/2014 10:12 AM, Frediano Ziglio wrote:
> From: Zoltan Kiss <zoltan.kiss@linaro.org>
>
> Signed-off-by: Zoltan Kiss <zoltan.kiss@huawei.com>
Reviewed-by: Julien Grall <julien.grall@linaro.org>
Regards,
> ---
> xen/common/device_tree.c | 14 ++++++++++----
> xen/include/xen/device_tree.h | 11 +++++++++++
> 2 files changed, 21 insertions(+), 4 deletions(-)
>
> diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
> index f72b2e9..e97c28b 100644
> --- a/xen/common/device_tree.c
> +++ b/xen/common/device_tree.c
> @@ -160,19 +160,25 @@ const void *dt_get_property(const struct dt_device_node *np,
> bool_t dt_property_read_u32(const struct dt_device_node *np,
> const char *name, u32 *out_value)
> {
> - u32 len;
> + return dt_property_read_u32_array(np, name, out_value, 1);
> +}
> +
> +bool_t dt_property_read_u32_array(const struct dt_device_node *np,
> + const char *name, u32 *out_value, u16 out_len)
> +{
> + u32 len, i;
> const __be32 *val;
>
> val = dt_get_property(np, name, &len);
> - if ( !val || len < sizeof(*out_value) )
> + if ( !val || len < sizeof(*out_value) * out_len )
> return 0;
>
> - *out_value = be32_to_cpup(val);
> + for ( i = 0; i < out_len; i++, val++ )
> + out_value[i] = be32_to_cpup(val);
>
> return 1;
> }
>
> -
> bool_t dt_property_read_u64(const struct dt_device_node *np,
> const char *name, u64 *out_value)
> {
> diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h
> index 08db8bc..5fcd9c4 100644
> --- a/xen/include/xen/device_tree.h
> +++ b/xen/include/xen/device_tree.h
> @@ -346,6 +346,17 @@ const struct dt_property *dt_find_property(const struct dt_device_node *np,
> bool_t dt_property_read_u32(const struct dt_device_node *np,
> const char *name, u32 *out_value);
> /**
> + * dt_property_read_u32_array - Helper to read a u32 array property.
> + * @np: node to get the value
> + * @name: name of the property
> + * @out_value: pointer to return value
> + * @out_len: lenght of the array
> + *
> + * Return true if get the desired value.
> + */
> +bool_t dt_property_read_u32_array(const struct dt_device_node *np,
> + const char *name, u32 *out_value, u16 out_len);
> +/**
> * dt_property_read_u64 - Helper to read a u64 property.
> * @np: node to get the value
> * @name: name of the property
>
--
Julien Grall
next prev parent reply other threads:[~2014-11-03 14:14 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-03 10:11 xen/arm: Add support for Huawei hip04-d01 platform Frediano Ziglio
2014-11-03 10:11 ` [PATCH 01/10] xen/arm: Implement " Frediano Ziglio
2014-11-03 13:39 ` Julien Grall
2015-01-13 11:58 ` Ian Campbell
2015-01-13 14:09 ` Frediano Ziglio
2015-01-13 14:42 ` Ian Campbell
2015-01-13 15:11 ` Frediano Ziglio
2015-01-13 15:23 ` Ian Campbell
2015-01-13 15:48 ` Frediano Ziglio
2015-02-19 14:23 ` Frediano Ziglio
2015-02-19 16:19 ` Ian Campbell
2014-11-03 10:11 ` [PATCH 02/10] xen/arm: Implement hip04-d01 board reboot Frediano Ziglio
2014-11-03 13:40 ` Julien Grall
2014-11-03 10:11 ` [PATCH 03/10] xen/arm: Define quirk for Hip04 GICv2 divergence Frediano Ziglio
2014-11-03 13:50 ` Julien Grall
2014-11-03 13:54 ` Ian Campbell
2014-11-03 10:11 ` [PATCH 04/10] xen/arm: Make gic-v2 code handle hip04-d01 platform Frediano Ziglio
2014-11-03 14:10 ` Julien Grall
2015-01-13 11:54 ` Ian Campbell
2015-01-13 13:36 ` Frediano Ziglio
2014-11-03 10:11 ` [PATCH 05/10] xen/arm: Add support for DTBs with strange names of Hip04 GICv2 Frediano Ziglio
2014-11-03 10:11 ` [PATCH 06/10] xen/arm: handle GICH register changes for hip04-d01 platform Frediano Ziglio
2014-11-03 14:12 ` Julien Grall
2014-11-03 10:11 ` [PATCH 07/10] xen/arm: Force domains to use normal GICv2 driver on Hip04 platform Frediano Ziglio
2014-11-03 14:16 ` Julien Grall
2015-01-13 11:54 ` Ian Campbell
2014-11-03 10:12 ` [PATCH 08/10] xen/arm: Move vGIC registers " Frediano Ziglio
2014-11-03 10:12 ` [PATCH 09/10] xen/device_tree: Add new helper to read arrays from a DTB Frediano Ziglio
2014-11-03 14:14 ` Julien Grall [this message]
2014-11-03 14:15 ` Julien Grall
2014-11-03 10:12 ` [PATCH 10/10] xen/arm: Handle different bootwrapper locations for Hip04 platform Frediano Ziglio
2014-11-03 14:13 ` Julien Grall
2014-11-03 15:28 ` Frediano Ziglio
2014-11-03 15:33 ` Julien Grall
2014-11-03 15:36 ` Frediano Ziglio
2014-11-03 15:40 ` Julien Grall
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=54578DBD.2040002@linaro.org \
--to=julien.grall@linaro.org \
--cc=frediano.ziglio@huawei.com \
--cc=ian.campbell@citrix.com \
--cc=stefano.stabellini@citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.org \
--cc=zoltan.kiss@huawei.com \
--cc=zoltan.kiss@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.