From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756160AbcB0HQG (ORCPT ); Sat, 27 Feb 2016 02:16:06 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:15633 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755933AbcB0HQE (ORCPT ); Sat, 27 Feb 2016 02:16:04 -0500 Reply-To: Subject: Re: [PATCH v3 1/2] gpio: designware: switch device node to fwnode References: <1456317210-42742-1-git-send-email-qiujiang@huawei.com> <1456317210-42742-2-git-send-email-qiujiang@huawei.com> <56CEEC58.9050303@huawei.com> To: Andy Shevchenko CC: Linus Walleij , Alexandre Courbot , Mika Westerberg , "linux-kernel@vger.kernel.org" , "linux-gpio@vger.kernel.org" , "linux-acpi@vger.kernel.org" , , , From: Jiang Qiu Message-ID: <56D14D1C.6090706@huawei.com> Date: Sat, 27 Feb 2016 15:15:40 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.74.160.152] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090203.56D14D29.010E,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 65266e4f8d643b25e27978af122c7a72 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2016/2/25 21:43, Andy Shevchenko 写道: > On Thu, Feb 25, 2016 at 1:58 PM, Jiang Qiu wrote: >> 在 2016/2/24 21:46, Andy Shevchenko 写道: >>> On Wed, Feb 24, 2016 at 2:33 PM, qiujiang wrote: > >>> - why do you use fwnode_*() instead of device_property_*() calls? >>> What prevents us to move to device property API directly? >> Yes, it looks more reasonable by using devce_property. Howerver, >> device_get_child_node_count was used here to find each child node. This >> API output the fwnode_handle for each child node directly, but device >> property APIs need 'dev' data instead. Actually, the effects of fwnode_*() >> and device_*() are the same. So, I used fwnode_*() APIs here. > > Right, looks okay then. > >>>> - node = dev->of_node; >>>> - if (!IS_ENABLED(CONFIG_OF_GPIO) || !node) >>>> + if (!IS_ENABLED(CONFIG_OF_GPIO) || !(dev->of_node)) >>>> return ERR_PTR(-ENODEV); >>> >>> So, since you converted to fwnode, do you still need this check? >>> >> Although this patch coverted device node to fwnode, only DTs binding was >> supported here, and patch2 support ACPI will remove this check. > > Yes, but like I said below device_get_child_node_count() will take > care of that, will it? Right, device_get_child_node_count() will take of it, this should be removed. > >>>> >>>> - nports = of_get_child_count(node); >>>> + nports = device_get_child_node_count(dev); >>>> if (nports == 0) >>>> return ERR_PTR(-ENODEV); >>> >>> ...I think this one fail if it will not found any child. >> This one fail? yes, it will return to failure. >> I am not very clear here. > > See above. Here, device_get_child_node_count will return ZERO if there is not any child. So, I think this will work ok, will it? >