From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Stabellini Subject: Re: [PATCH 09/10] xen: arm: Drop device_tree_node_compatible Date: Wed, 18 Jun 2014 15:43:20 +0100 Message-ID: References: <1402919079.14907.22.camel@kazak.uk.xensource.com> <1402919103-29642-9-git-send-email-ian.campbell@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1402919103-29642-9-git-send-email-ian.campbell@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: stefano.stabellini@eu.citrix.com, Naresh Bhat , julien.grall@linaro.org, tim@xen.org, xen-devel@lists.xen.org, Roy Franz , Fu Wei List-Id: xen-devel@lists.xenproject.org On Mon, 16 Jun 2014, Ian Campbell wrote: > Instead use fdt_node_check_compatible from libfdt. Unfortunately the two functions are not equivalent: fdt_node_check_compatible uses memcmp while device_tree_node_compatible uses strcasecmp that ignores cases. At the very least we should make a note of this in the commit message. > Signed-off-by: Ian Campbell > --- > xen/arch/arm/bootfdt.c | 28 ++-------------------------- > 1 file changed, 2 insertions(+), 26 deletions(-) > > diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c > index a80055c..8ab45c9 100644 > --- a/xen/arch/arm/bootfdt.c > +++ b/xen/arch/arm/bootfdt.c > @@ -31,30 +31,6 @@ static bool_t __init device_tree_node_matches(const void *fdt, int node, > && (name[match_len] == '@' || name[match_len] == '\0'); > } > > -static bool_t __init device_tree_node_compatible(const void *fdt, int node, > - const char *match) > -{ > - int len, l; > - int mlen; > - const void *prop; > - > - mlen = strlen(match); > - > - prop = fdt_getprop(fdt, node, "compatible", &len); > - if ( prop == NULL ) > - return 0; > - > - while ( len > 0 ) { > - if ( !dt_compat_cmp(prop, match) ) > - return 1; > - l = strlen(prop) + 1; > - prop += l; > - len -= l; > - } > - > - return 0; > -} > - > static void __init device_tree_get_reg(const __be32 **cell, u32 address_cells, > u32 size_cells, u64 *start, u64 *size) > { > @@ -261,8 +237,8 @@ static int __init early_scan_node(const void *fdt, > { > if ( device_tree_node_matches(fdt, node, "memory") ) > process_memory_node(fdt, node, name, address_cells, size_cells); > - else if ( device_tree_node_compatible(fdt, node, "xen,multiboot-module" ) || > - device_tree_node_compatible(fdt, node, "multiboot,module" )) > + else if ( fdt_node_check_compatible(fdt, node, "xen,multiboot-module" ) || > + fdt_node_check_compatible(fdt, node, "multiboot,module" )) > process_multiboot_node(fdt, node, name, address_cells, size_cells); > else if ( depth == 1 && device_tree_node_matches(fdt, node, "chosen") ) > process_chosen_node(fdt, node, name, address_cells, size_cells); > -- > 1.7.10.4 >