From patchwork Mon Aug 22 14:07:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Finley Xiao X-Patchwork-Id: 9293605 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 5ABFC607D0 for ; Mon, 22 Aug 2016 14:07:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E47A287B9 for ; Mon, 22 Aug 2016 14:07:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4265B289DC; Mon, 22 Aug 2016 14:07:19 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B3232287B9 for ; Mon, 22 Aug 2016 14:07:18 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bbpsj-0004cp-Hl; Mon, 22 Aug 2016 14:07:17 +0000 Received: from regular1.263xmail.com ([211.150.99.133]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bbpsP-00049R-AS; Mon, 22 Aug 2016 14:06:59 +0000 Received: from xf?rock-chips.com (unknown [192.168.167.231]) by regular1.263xmail.com (Postfix) with ESMTP id DC7378F83; Mon, 22 Aug 2016 22:06:27 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 Received: from [172.16.12.15] (localhost.localdomain [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id 3A75B586B3; Mon, 22 Aug 2016 22:06:26 +0800 (CST) X-RL-SENDER: xf@rock-chips.com X-FST-TO: lin.huang@rock-chips.com X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: xf@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-SENDER: xf@rock-chips.com X-DNS-TYPE: 0 Received: from [172.16.12.15] (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith ESMTP id 4895TK6OBV; Mon, 22 Aug 2016 22:06:28 +0800 (CST) Subject: Re: [PATCH v1 2/3] of: Add support for reading a s32 from a multi-value property. To: David Woodhouse , Heiko Stuebner References: <1471315139-28285-1-git-send-email-finley.xiao@rock-chips.com> <1471315139-28285-3-git-send-email-finley.xiao@rock-chips.com> <1471616119.61594.465.camel@infradead.org> <4975010.IL95Y3Sj1J@phil> <1471639654.4611.2.camel@infradead.org> From: Finley Xiao Message-ID: <5e7a7b9f-44c2-82c2-eb17-ee54efd15503@rock-chips.com> Date: Mon, 22 Aug 2016 22:07:40 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1471639654.4611.2.camel@infradead.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160822_070658_185134_040BE84F X-CRM114-Status: UNSURE ( 8.37 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, nm@ti.com, viresh.kumar@linaro.org, linux-kernel@vger.kernel.org, tony.xie@rock-chips.com, srinivas.kandagatla@linaro.org, frowand.list@gmail.com, tim.chen@rock-chips.com, khilman@kernel.org, dbaryshkov@gmail.com, linux-rockchip@lists.infradead.org, ulysses.huang@rock-chips.com, jay.xu@rock-chips.com, sboyd@codeaurora.org, wxt@rock-chips.com, devicetree@vger.kernel.org, linux-pm@vger.kernel.org, lin.huang@rock-chips.com, robh+dt@kernel.org, maxime.ripard@free-electrons.com, linux-arm-kernel@lists.infradead.org, rjw@rjwysocki.net, sre@kernel.org, rocky.hao@rock-chips.com Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 在 2016/8/20 4:47, David Woodhouse 写道: > On Fri, 2016-08-19 at 22:41 +0200, Heiko Stuebner wrote: >>> So no, don't *add* any more of these functions. Only add the generic >>> version. And if your driver isn't using the generic property >>> functions... fix it. >> As far as I can see, all the device_property_* functions are grounded on their >> of_property_*, acpi_property_* etc counterparts and functions reading specific >> elements (the _index variants) are currently not available at all. >> >> drivers/base/property.c: >> #define OF_DEV_PROP_READ_ARRAY(node, propname, type, val, nval) \ >> (val) ? of_property_read_##type##_array((node), (propname), (val), (nval)) \ >> : of_property_count_elems_of_size((node), (propname), sizeof(type)) >> >> So even if you're using the device_property_* functions you'd still need >> a match in the underlying functions or am I missing something? > Yes, but the underlying function should never be used directly by > drivers. And should probably be prefixed with __ or marked deprecated > (with an override in its one genuine call site). > So can I add a device_property_read_s32_array function in property.h? --- a/include/linux/property.h +++ b/include/linux/property.h @@ -108,6 +108,13 @@ static inline int device_property_read_u32(struct device *dev, return device_property_read_u32_array(dev, propname, val, 1); } +static inline int device_property_read_s32_array(struct device *dev, const char *propname, + s32 *val, size_t nval) +{ + return device_property_read_u32_array(struct device *dev, const char *propname, + (u32 *)val, size_t nval); +}