From patchwork Sun Mar 12 22:11:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 9619577 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 81F1360414 for ; Sun, 12 Mar 2017 22:11:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7558828343 for ; Sun, 12 Mar 2017 22:11:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A3B128410; Sun, 12 Mar 2017 22:11:46 +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 2251428343 for ; Sun, 12 Mar 2017 22:11:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935395AbdCLWLp (ORCPT ); Sun, 12 Mar 2017 18:11:45 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:60678 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935414AbdCLWLi (ORCPT ); Sun, 12 Mar 2017 18:11:38 -0400 Received: from localhost.localdomain ([95.91.4.8]) by mrelayeu.kundenserver.de (mreue004 [212.227.15.167]) with ESMTPSA (Nemesis) id 0MhgyF-1caD243UCB-00MrpP; Sun, 12 Mar 2017 23:11:19 +0100 From: Stefan Wahren To: Eduardo Valentin , Zhang Rui , kernel@martin.sperl.org Cc: Eric Anholt , Rob Herring , Frank Rowand , Florian Fainelli , linux-rpi-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-pm@vger.kernel.org, Stefan Wahren Subject: [PATCH V11 1/6] of: base: Implement read function for s32 array Date: Sun, 12 Mar 2017 22:11:00 +0000 Message-Id: <1489356665-3175-2-git-send-email-stefan.wahren@i2se.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1489356665-3175-1-git-send-email-stefan.wahren@i2se.com> References: <1489356665-3175-1-git-send-email-stefan.wahren@i2se.com> X-Provags-ID: V03:K0:kPH2YEOvGGLpYPoHXvYm03tFzZIqO3AFPgGb7xz5jSWvfNE+Isd JagNT+Rj2JMKBWndDI85neiQHfkSsaZsomW/qBYX4/zQohCYl1FZ2X2KeIBduWdeipwgQTm drXwOJ5mb+b/1/LHiUF9DT0bmeYCLCpJdsprqz+eOlmGnzHpv34lSOyojGf9LdWTgTGMKuA v9z2l1f+AOgxYuXk6Cprg== X-UI-Out-Filterresults: notjunk:1; V01:K0:OqeGdmY/CaE=:tLtcyDchVSruC4A41cnYeV D0PhCgVp9IOiHrvF7UO33YOzPMGkJIg6POCEC3Ly78aOwd8KLzatPhZV8e0lnJ4v9C2/0XYC/ +9s+ZERR7jTY896AO9evJ/0JFYbo9AeSIB32gYEzM2YVlyE/EGCkU9LANslvKlOkU/Z556aZZ vNBBiJDi5bCPsn62Y+jRYE+CMaefxAgdzoWTZ5uFSuP+hOAJiwjOYQm8kRgesiQwnS3zpaUR6 6Yo+oQozqU7XzDHNmCpJkHdua1qCV+O+oSirMDt6AzpYYHJJLntOOGbpLnESMnYHo4n5BXP3Q ihwDnVT5bUMm+v4XmGOD5h0qqnUadA+renCQ/Q6AFggQfCeh8OgD7S91ZshcxogUYxvUK4myv LNlWsXi1QJaCa/fLOCxIMt/gl0s22yXLP0f9czO8fsFiJoEo6s3MDPgmkqIHtlrpyZH8591YU s40Ax1T0KaEHN51oyPqE2kv2eDwDCTzrYVkwdS9mXO3nACRNZdlj5vZ38IzW3hwyaUypZ0/jt e2akzdR32+W8BdK7cLlEKmmBkLvF4fKsjiDnk3I8gMmuHw5M5AbwHyegsfbl2jXbGqFSPIWIC xihAMd3NHzXeX0BJlf6LDlfjAlywgwyHlla92RB68HLq1boQFzYr6wkyAzPJJIYFBkN2RB21D j/SrqDND8pItc0F0ofhV3sfseLnrkKyTIxlNXh/DtpLTUjKM+Qm27F3k388jyo5K+ZkE= 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 Reviewed-by: Frank Rowand --- 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)