]> xenbits.xensource.com Git - xen.git/commitdiff
xen/dt: Extend dt_device_match to possibly store data
authorJulien Grall <julien.grall@linaro.org>
Fri, 30 Jan 2015 18:49:18 +0000 (18:49 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 20 Feb 2015 14:01:02 +0000 (14:01 +0000)
Some drivers may want to configure differently the device depending on
the compatible string. For this purpose, add a new field in the
dt_device_match to store the data.

Also modify the return type of dt_match_node to return the matching
structure.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
xen/arch/arm/platform.c
xen/common/device_tree.c
xen/include/xen/device_tree.h

index cb4cda822cab32a57416e0bc7c7360d03df21612..a79a0980799bafdbf93fa6973f9fa45e818ee472 100644 (file)
@@ -157,7 +157,7 @@ bool_t platform_device_is_blacklisted(const struct dt_device_node *node)
     if ( platform && platform->blacklist_dev )
         blacklist = platform->blacklist_dev;
 
-    return dt_match_node(blacklist, node);
+    return (dt_match_node(blacklist, node) != NULL);
 }
 
 unsigned int platform_dom0_evtchn_ppi(void)
index f72b2e9f0f9497d629616f5d82bf2b5b0f7385a7..34a1b9e645a5588bc9008edb207de813548f2c65 100644 (file)
@@ -290,11 +290,12 @@ struct dt_device_node *dt_find_node_by_alias(const char *alias)
     return NULL;
 }
 
-bool_t dt_match_node(const struct dt_device_match *matches,
-                     const struct dt_device_node *node)
+const struct dt_device_match *
+dt_match_node(const struct dt_device_match *matches,
+              const struct dt_device_node *node)
 {
     if ( !matches )
-        return 0;
+        return NULL;
 
     while ( matches->path || matches->type ||
             matches->compatible || matches->not_available )
@@ -314,12 +315,11 @@ bool_t dt_match_node(const struct dt_device_match *matches,
             match &= !dt_device_is_available(node);
 
         if ( match )
-            return match;
-
+            return matches;
         matches++;
     }
 
-    return 0;
+    return NULL;
 }
 
 const struct dt_device_node *dt_get_parent(const struct dt_device_node *node)
index 08db8bc22fb61de65473b090bf301d1865fecb77..65023694079f0bd76b6a76518ec2b88105811fef 100644 (file)
@@ -28,6 +28,7 @@ struct dt_device_match {
     const char *type;
     const char *compatible;
     const bool_t not_available;
+    const void *data;
 };
 
 #define DT_MATCH_PATH(p)                { .path = p }
@@ -547,8 +548,9 @@ bool_t dt_device_is_available(const struct dt_device_node *device);
  *
  * Returns true if the device node match one of dt_device_match.
  */
-bool_t dt_match_node(const struct dt_device_match *matches,
-                     const struct dt_device_node *node);
+const struct dt_device_match *
+dt_match_node(const struct dt_device_match *matches,
+              const struct dt_device_node *node);
 
 /**
  * dt_find_matching_node - Find a node based on an dt_device_match match table