From: Ian Campbell Subject: Re: [PATCH 2/9] xen: arm: parse modules from DT during early boot. Date: Mon, 10 Dec 2012 13:14:41 +0000 Message-ID: <1355145281.21160.21.camel@zakaz.uk.xensource.com> References: <1354799399.17165.93.camel@zakaz.uk.xensource.com> <1354799451-16876-2-git-send-email-ian.campbell@citrix.com> <1355132370.31710.98.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini Cc: "Tim (Xen.org)" , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Mon, 2012-12-10 at 13:04 +0000, Stefano Stabellini wrote: > > > You have really written a lot of code here! > > > I would have thought that just matching on the compatible string would > > > be enough: > > > > > > else if ( device_tree_node_matches(fdt, node, "linux-zimage") ) > > > process_linuxzimage_node(fdt, node, name, address_cells, size_cells); > > > else if ( device_tree_node_matches(fdt, node, "linux-initrd") ) > > > process_linuxinitrd_node(fdt, node, name, address_cells, size_cells); > > > > > > so that your process_linuxzimage_node and process_linuxinitrd_node start > > > from the right node and have everything they need to parse it > > > > Is the tree structure of Device Tree meaningless? I'd have thought that > > a compatible node would only have meaning at a particular place in the > > tree. Granted compatible nodes are often pretty specific and precise, > > but is that inherent enough in DT that we can rely on it? > > I don't know if it is entirely meaningless, but surely the compatible > string is regarded as a much more reliable way to identify a node AFAIK. > More often than not Linux drivers just use of_find_compatible_node to > find their DT node. Hrm, that sounds rather odd to me. Anyway, there isn't much code needed to do it right -- there's only ~ a dozen lines to do with actually walking the tree. The rest (i.e. the majority of this patch) is the internals of process_chosen_modules_node, the docs and the data structure which would be pretty much the same regardless of walking the tree. Ian.