From patchwork Fri Mar 3 23:18:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 9603675 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8E800602B4 for ; Fri, 3 Mar 2017 23:20:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D2A92846A for ; Fri, 3 Mar 2017 23:20:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 711AD2861C; Fri, 3 Mar 2017 23:20:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_SORBS_SPAM autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0FC4B285B8 for ; Fri, 3 Mar 2017 23:20:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=TkN0esKUuGbbOSEXmTDLUNvt9dK5vFanb6uSe15nMK0=; b=HNGEuiA3IXAdUbi3Whws078p1G 9CDfNNl3MdRrkFr9p9hHIRDn8ZTegxIM09OgYGt/xBV870CUXQUGEuAkNWSrm9HQ6lxUe2Tpz+xgD IQevzPLmXmy0DyCLrn96G53a2ndaZBOjMqZ+EAxL+RW5qceFP1Gs410U4MyRMnbMmB2kbC8o8ww+X aHpJ2Ina7K/n7b1Anu2w1AszQPvyPbxAtvUb9IYdS3rPeXox3KYtiD27l3bQOQ3mnWACAisilcPGN WxOWW2AUhfCvwQesGxTV4tp0Pzp37FKiLsrhgvzkb/g0ckuvrfXloTHZoZie86TbDRnFZc4ssGno7 bhS16fTA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cjwUd-00036r-MU; Fri, 03 Mar 2017 23:20:11 +0000 Received: from mout.kundenserver.de ([212.227.126.133]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cjwU5-0001f5-5b; Fri, 03 Mar 2017 23:19:41 +0000 Received: from localhost.localdomain ([95.91.4.8]) by mrelayeu.kundenserver.de (mreue002 [212.227.15.167]) with ESMTPSA (Nemesis) id 0Mboqj-1d2Ifh0guD-00Izo1; Sat, 04 Mar 2017 00:19:00 +0100 From: Stefan Wahren To: Eric Anholt , Zhang Rui , Eduardo Valentin Subject: [PATCH V10 1/6] of: base: Implement read function for s32 array Date: Fri, 3 Mar 2017 23:18:44 +0000 Message-Id: <1488583129-4159-2-git-send-email-stefan.wahren@i2se.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1488583129-4159-1-git-send-email-stefan.wahren@i2se.com> References: <1488583129-4159-1-git-send-email-stefan.wahren@i2se.com> X-Provags-ID: V03:K0:g2xqgpD/OEP9hri9NakIkiA5MS/yD7xZeJRVmFAV2n4ek28392g eczwyq2jYYrQI+2JKIEcWGMPlQgMS+Nf/TKBL2zlbNdaNOcJlC9XDs72kUyoplStgWK64al C/r0GHcIoncv7g/xmAFxpKVmTLnt3xxN9B/GnUGnDTIo+lSdiLHjxug3HWB5e3/Ka5jY1tB HJpGJ39DpFqWNrwC0CN2Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:07l4NtHmQI4=:+CZW0rUkirFG7Q8FWGxaSM iKfG8dz/kY11/uvpK6gl5iwsMCvv3S7AIwIToPJRZ27Tl1OtBzPbeeRFlyvvJE4UvUWuFvLZl huAfWXkaR+RlcSZNLCA9MS5jgkBbwNV7M0akTbZBSHbNGVjVTOQgB6s/szK41UIQNZvIwNz9+ TGkywfyhnnlrUl40r608HAC8IYkeEijqrNHjTqtnhRFzaC9/yxNRTOk1jeNOkFufIThR7UAuJ WmscYT3ms7wtko4u8FpZjEhkQ57yc0mvaEixrynx7MX/mkAY+SkORPHzW7I8O58ljOcEvvXOm LCRaotGGfeuTVVUeBqphk7ZVlp2FWhnqzqpv6EYX16DRj1oi1DQ5ZDafErdXstr97NzLzcwsI mRguN0AkO/FDMTSW/xbeBE6Lg45n9InMKgShA2IJ5oUOtSaQNGYqRSrume+RgO42ULkYCHl0h blfY0nER+y23f2tbL4EkgI2OoQm5kxQfBL0nFHrfNbEY8wjG7XhTbMZ7bHA+9Sm+9L5NqNPmO OkLA0lQMeRB50Y8kr5wSIcgwcJmVE4C9Obkj9c+NWXsICQNazIdGP3YPBnb4Nf00e2AAnfZ3N Oqpv1ie69pXacnZihqlrOrtkUMimqNMYT1Ylg0RKJTVitYV8sDefO66OhvWQAcTH3U/6kAq6v WHYSMCz4y9xsW1CPbRANMSS8SPTbdK1RR1Hv6P67MC+KlyGC7qp9HzT+EYAnfjCzbM4s= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170303_151937_582654_8CE2BFCF X-CRM114-Status: UNSURE ( 9.87 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Wahren , devicetree@vger.kernel.org, Florian Fainelli , linux-pm@vger.kernel.org, Catalin Marinas , Will Deacon , Rob Herring , linux-rpi-kernel@lists.infradead.org, Martin Sperl , Frank Rowand , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP In order to read signed thermal coefficients from DT we need a proper function. Signed-off-by: Stefan Wahren --- include/linux/of.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/include/linux/of.h b/include/linux/of.h index 21e6323..98a046a 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -474,6 +474,34 @@ static inline int of_property_read_u32_array(const struct device_node *np, } /** + * of_property_read_s32_array - Find and read an array of 32 bit signed 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. Returns 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 s32 value can be decoded. + */ +static inline int of_property_read_s32_array(const struct device_node *np, + const char *propname, + s32 *out_values, size_t sz) +{ + int ret = of_property_read_variable_u32_array(np, propname, out_values, + sz, 0); + if (ret >= 0) + return 0; + else + return ret; +} + +/** * of_property_read_u64_array - Find and read an array of 64 bit integers * from a property. * @@ -676,6 +704,13 @@ static inline int of_property_read_u32_array(const struct device_node *np, return -ENOSYS; } +static inline int of_property_read_s32_array(const struct device_node *np, + const char *propname, + s32 *out_values, size_t sz) +{ + return -ENOSYS; +} + static inline int of_property_read_u64_array(const struct device_node *np, const char *propname, u64 *out_values, size_t sz)