[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 07/17] xen/device-tree: Add dt_property_read_u32_array helper


  • To: Rahul Singh <Rahul.Singh@xxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Wed, 29 Sep 2021 07:35:04 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=1FdtwCajRj+TzN7SdJwtQacsfMcLW+OGcADYIRdUN4Q=; b=B59M2IFrfBt5/mWxmT1LtwiYoRwTFqUM5IR+ZdJ7jCIKls3LdNhPKW3oo+8W3v7a0Ng8b4yDMhRfLpyQFl7jyHw2jCRQgVSIiP29zTita8igoyKCuI3oxqnsWjlBbT+esyy/AFQ1PwfzLPFxt/0YuqGFKLNprqecOI6ZdFfdllPH228kFNmeq0Jg8CuLUPl94q7aeHDKscdQNgc3DHukXsjR5ClWCQ82Q+JlsuHb3mGvkQvEultla6rfTI6vJFb/AEKnKVZbPOUWelA+wiZSj9TzsjIzQmh9iqK/TJQLXD2BT9NOszhGUib4WwTkw5Syow+oE+hBNUIZUBzB4+lWQA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZwzNeteHmBkOzcQwoH0Md1EXw3chh3GtSR9CK4JTzJctVRJRlBrmaPgy903NwcrElYIiZvOf+0EuUJtmtSGi6JA7xEbCkchokjRcGsKi2TI3PmMNy1wCwjASmc+DQYfUN2A3NkB3MbubUiiw3Ra0Ba0EM4ZL++2+ykk4u2gLxHR/lLN2OiPXy3NtMF469s+hEbWuMxCRhzlh1UrWXDXEh0F8BMdd3TZB7G1t2fPrTR4JcBMeAV0xd/KzVMOVYAL/OiVSSUBLeRmEIfLjrVXbPkZKyBp94+KyCZ3kakpzpI6ruhJg3ozuTqoTqqUzBQcByaVv5dcBmtYT50jFmapPnw==
  • Authentication-results-original: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andre Przywara <Andre.Przywara@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>
  • Delivery-date: Wed, 29 Sep 2021 07:35:32 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHXtJWv7GtV+W3zUUON47opBlrdw6u6n90A
  • Thread-topic: [PATCH v3 07/17] xen/device-tree: Add dt_property_read_u32_array helper

Hi Rahul,

> On 28 Sep 2021, at 19:18, Rahul Singh <rahul.singh@xxxxxxx> wrote:
> 
> Based Linux commit a67e9472da423ec47a3586920b526ebaedf25fc3
> 
> Import the Linux helper of_property_read_u32_array. This function find
> and read an array of 32 bit integers from a property.
> 
> Signed-off-by: Rahul Singh <rahul.singh@xxxxxxx>
Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

Cheers
Bertrand

> ---
> Change in v3:
> - Modify commit message to include upstream Linux commit-id not stable
>  Linux commit-id
> Change in v2: Patch introduced in v2
> ---
> xen/include/xen/device_tree.h | 30 ++++++++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
> 
> diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h
> index 1693fb8e8c..3ffe3eb3d2 100644
> --- a/xen/include/xen/device_tree.h
> +++ b/xen/include/xen/device_tree.h
> @@ -392,6 +392,36 @@ int dt_property_read_variable_u32_array(const struct 
> dt_device_node *np,
>                                         const char *propname, u32 *out_values,
>                                         size_t sz_min, size_t sz_max);
> 
> +/**
> + * dt_property_read_u32_array - Find and read an array of 32 bit integers
> + * from a property.
> + *
> + * @np:     device node from which the property value is to be read.
> + * @propname:   name of the property to be searched.
> + * @out_values: pointer to return value, modified only if return value is 0.
> + * @sz:     number of array elements to read
> + *
> + * Search for a property in a device node and read 32-bit value(s) from
> + * it.
> + *
> + * Return: 0 on success, -EINVAL if the property does not exist,
> + * -ENODATA if property does not have a value, and -EOVERFLOW if the
> + * property data isn't large enough.
> + *
> + * The out_values is modified only if a valid u32 value can be decoded.
> + */
> +static inline int dt_property_read_u32_array(const struct dt_device_node *np,
> +                                             const char *propname,
> +                                             u32 *out_values, size_t sz)
> +{
> +    int ret = dt_property_read_variable_u32_array(np, propname, out_values,
> +                              sz, 0);
> +    if ( ret >= 0 )
> +        return 0;
> +    else
> +        return ret;
> +}
> +
> /**
>  * dt_property_read_bool - Check if a property exists
>  * @np: node to get the value
> -- 
> 2.17.1
> 




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.