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: 9603681 X-Patchwork-Delegate: eduardo.valentin@ti.com 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 CD2B1602B4 for ; Fri, 3 Mar 2017 23:21:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE2042861C for ; Fri, 3 Mar 2017 23:21:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B284F28621; Fri, 3 Mar 2017 23:21:32 +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=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 55E482861F for ; Fri, 3 Mar 2017 23:21:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752199AbdCCXVa (ORCPT ); Fri, 3 Mar 2017 18:21:30 -0500 Received: from mout.kundenserver.de ([212.227.126.133]:55324 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752156AbdCCXVM (ORCPT ); Fri, 3 Mar 2017 18:21:12 -0500 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 Cc: Martin Sperl , Catalin Marinas , Will Deacon , Rob Herring , Frank Rowand , Florian Fainelli , linux-rpi-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Stefan Wahren 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= Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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)