From nobody Fri Nov 29 18:29:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=arm.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1632310693889828.9167292510872; Wed, 22 Sep 2021 04:38:13 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.192565.343069 (Exim 4.92) (envelope-from ) id 1mT0Zb-0008H6-Iw; Wed, 22 Sep 2021 11:37:59 +0000 Received: by outflank-mailman (output) from mailman id 192565.343069; Wed, 22 Sep 2021 11:37:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mT0Zb-0008Gz-GA; Wed, 22 Sep 2021 11:37:59 +0000 Received: by outflank-mailman (input) for mailman id 192565; Wed, 22 Sep 2021 11:37:58 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mT0Za-0008Gc-Bt for xen-devel@lists.xenproject.org; Wed, 22 Sep 2021 11:37:58 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id 2e26ecf1-1f2d-4167-9210-37c43a669938; Wed, 22 Sep 2021 11:37:57 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1F11011B3; Wed, 22 Sep 2021 04:37:57 -0700 (PDT) Received: from e109506.cambridge.arm.com (e109506.cambridge.arm.com [10.1.199.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 39D573F719; Wed, 22 Sep 2021 04:37:56 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 2e26ecf1-1f2d-4167-9210-37c43a669938 From: Rahul Singh To: xen-devel@lists.xenproject.org Cc: bertrand.marquis@arm.com, rahul.singh@arm.com, andre.przywara@arm.com, Stefano Stabellini , Julien Grall Subject: [PATCH v2 07/17] xen/device-tree: Add dt_property_read_u32_array helper Date: Wed, 22 Sep 2021 12:34:53 +0100 Message-Id: <852610e258d4c36888b68771061afdc0df95e401.1632307952.git.rahul.singh@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-ZM-MESSAGEID: 1632310696121100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Based on tag Linux v5.14.2 commit bbdd3de144fc142f2f4b9834c9241cc4e7f3d3fc 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 --- Change in v2: Patch introduced in v2 --- xen/include/xen/device_tree.h | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h index 1693fb8e8c..497144b8a7 100644 --- a/xen/include/xen/device_tree.h +++ b/xen/include/xen/device_tree.h @@ -366,7 +366,6 @@ bool_t dt_property_read_u32(const struct dt_device_node= *np, bool_t dt_property_read_u64(const struct dt_device_node *np, const char *name, u64 *out_value); =20 - /** * dt_property_read_variable_u32_array - Find and read an array of 32 bit * integers from a property, with bounds on the minimum and maximum array = size. @@ -392,6 +391,36 @@ int dt_property_read_variable_u32_array(const struct d= t_device_node *np, const char *propname, u32 *out_val= ues, size_t sz_min, size_t sz_max); =20 +/** + * 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 =3D dt_property_read_variable_u32_array(np, propname, out_valu= es, + sz, 0); + if ( ret >=3D 0 ) + return 0; + else + return ret; +} + /** * dt_property_read_bool - Check if a property exists * @np: node to get the value --=20 2.17.1