diff mbox

[V1,07/29] xen: Use the right string comparison function in device tree

Message ID 1377701263-3319-8-git-send-email-julien.grall@linaro.org
State Superseded, archived
Headers show

Commit Message

Julien Grall Aug. 28, 2013, 2:47 p.m. UTC
When of_node_cmp and of_compat_cmp was introduced in commit fb97eb6
"xen/arm: Create a hierarchical device tree", they were copied from the wrong
Linux header.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---
 xen/common/device_tree.c      |    6 +++---
 xen/include/xen/device_tree.h |    4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

Comments

Ian Campbell Sept. 10, 2013, 10:35 a.m. UTC | #1
On Wed, 2013-08-28 at 15:47 +0100, Julien Grall wrote:
> @@ -549,7 +549,7 @@ dt_find_property(const struct dt_device_node *np,
>  
>      for ( pp = np->properties; pp; pp = pp->next )
>      {
> -        if ( strcmp(pp->name, name) == 0 )
> +        if ( dt_prop_cmp(pp->name, name) == 0 )

This guy isn't added until patch #9.
Julien Grall Sept. 10, 2013, 12:51 p.m. UTC | #2
On 09/10/2013 11:35 AM, Ian Campbell wrote:
> On Wed, 2013-08-28 at 15:47 +0100, Julien Grall wrote:
>> @@ -549,7 +549,7 @@ dt_find_property(const struct dt_device_node *np,
>>  
>>      for ( pp = np->properties; pp; pp = pp->next )
>>      {
>> -        if ( strcmp(pp->name, name) == 0 )
>> +        if ( dt_prop_cmp(pp->name, name) == 0 )
> 
> This guy isn't added until patch #9.

Good catch. I will move the patch later, thanks.
diff mbox

Patch

diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
index a5abdaa..be592d2 100644
--- a/xen/common/device_tree.c
+++ b/xen/common/device_tree.c
@@ -144,7 +144,7 @@  bool_t __init device_tree_node_compatible(const void *fdt, int node,
         return 0;
 
     while ( len > 0 ) {
-        if ( !dt_compat_cmp(prop, match, mlen) )
+        if ( !dt_compat_cmp(prop, match) )
             return 1;
         l = strlen(prop) + 1;
         prop += l;
@@ -549,7 +549,7 @@  dt_find_property(const struct dt_device_node *np,
 
     for ( pp = np->properties; pp; pp = pp->next )
     {
-        if ( strcmp(pp->name, name) == 0 )
+        if ( dt_prop_cmp(pp->name, name) == 0 )
         {
             if ( lenp )
                 *lenp = pp->length;
@@ -594,7 +594,7 @@  bool_t dt_device_is_compatible(const struct dt_device_node *device,
         return 0;
     while ( cplen > 0 )
     {
-        if ( dt_compat_cmp(cp, compat, strlen(compat)) == 0 )
+        if ( dt_compat_cmp(cp, compat) == 0 )
             return 1;
         l = strlen(cp) + 1;
         cp += l;
diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h
index 69ee0cd..7cbf736 100644
--- a/xen/include/xen/device_tree.h
+++ b/xen/include/xen/device_tree.h
@@ -229,8 +229,8 @@  extern const struct dt_device_node *dt_interrupt_controller;
  */
 struct dt_device_node * __init dt_find_interrupt_controller(const char *compat);
 
-#define dt_node_cmp(s1, s2) strcmp((s1), (s2))
-#define dt_compat_cmp(s1, s2, l) strnicmp((s1), (s2), l)
+#define dt_node_cmp(s1, s2) strcasecmp((s1), (s2))
+#define dt_compat_cmp(s1, s2) strcasecmp((s1), (s2))
 
 /* Default #address and #size cells */
 #define DT_ROOT_NODE_ADDR_CELLS_DEFAULT 1