From: Ian Campbell Subject: Re: [RFC for-4.5 05/12] xen/dts: Add dt_parse_phandle_with_args and dt_parse_phandle Date: Wed, 19 Feb 2014 16:26:26 +0000 Message-ID: <1392827186.29739.92.camel@kazak.uk.xensource.com> References: <1391794991-5919-1-git-send-email-julien.grall@linaro.org> <1391794991-5919-6-git-send-email-julien.grall@linaro.org> <1392813280.29739.43.camel@kazak.uk.xensource.com> <5304D924.4090504@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WGA0A-0000E0-9p for xen-devel@lists.xenproject.org; Wed, 19 Feb 2014 16:28:04 +0000 In-Reply-To: <5304D924.4090504@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall Cc: xen-devel@lists.xenproject.org, tim@xen.org, stefano.stabellini@citrix.com, patches@linaro.org List-Id: xen-devel@lists.xenproject.org On Wed, 2014-02-19 at 16:17 +0000, Julien Grall wrote: > >> +/** > >> + * dt_parse_phandle - Resolve a phandle property to a device_node pointer > >> + * @np: Pointer to device node holding phandle property > >> + * @phandle_name: Name of property holding a phandle value > >> + * @index: For properties holding a table of phandles, this is the index into > >> + * the table > > > > Otherwise it is -1 or something else? > > Even with one element, the property contains a table of phandles. So, > the first index is always 0. OK, so the "For a properties holding a table..." bit is misleading (that's the "otherwise" I was referring too, e..g properties which do not hold a table0, since this is always the index, even if the table has a single element. > > How do I decide the correct size for out_args? > > out_args is a structure dt_phandle_args which contains the node and an > array of arguments. > > The function is designed to parse one phandle by one phandle. So > out_args is either NULL (we don't want to get the info) or contains a > pointer to the structure to fill. > > The description of out_args seems clear to me. Does it miss something? No, I didn't realise that the array was within dt_phandle_args rather than out_args itself being a pointer to an array (the plural name is a bit confusing in that regard). I see the name comes from Linux, so no need to change. Ian.