[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 09/10] xen: arm: Drop device_tree_node_compatible



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 <ian.campbell@xxxxxxxxxx>
> ---
>  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
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.