From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755902AbcHVOHB (ORCPT ); Mon, 22 Aug 2016 10:07:01 -0400 Received: from regular1.263xmail.com ([211.150.99.133]:46683 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755461AbcHVOGt (ORCPT ); Mon, 22 Aug 2016 10:06:49 -0400 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 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-DNS-TYPE: 0 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> Cc: srinivas.kandagatla@linaro.org, maxime.ripard@free-electrons.com, robh+dt@kernel.org, frowand.list@gmail.com, sre@kernel.org, dbaryshkov@gmail.com, mark.rutland@arm.com, khilman@kernel.org, nm@ti.com, rjw@rjwysocki.net, viresh.kumar@linaro.org, sboyd@codeaurora.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, wxt@rock-chips.com, jay.xu@rock-chips.com, rocky.hao@rock-chips.com, tim.chen@rock-chips.com, tony.xie@rock-chips.com, ulysses.huang@rock-chips.com, lin.huang@rock-chips.com 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> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 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); +} -- Finley