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

[Xen-devel] [RFC for-4.8 1/6] xen/arm: Add device_get_desc()



From: "Edgar E. Iglesias" <edgar.iglesias@xxxxxxxxxx>

Add device_get_desc, a function to lookup the device descriptor
for a DT node. This is in preparation for adding per device
mapping implementations.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xxxxxxxxxx>
---
 xen/arch/arm/device.c        | 15 +++++++++++++++
 xen/include/asm-arm/device.h |  1 +
 2 files changed, 16 insertions(+)

diff --git a/xen/arch/arm/device.c b/xen/arch/arm/device.c
index a0072c1..1b934b9 100644
--- a/xen/arch/arm/device.c
+++ b/xen/arch/arm/device.c
@@ -83,6 +83,21 @@ enum device_class device_get_class(const struct 
dt_device_node *dev)
     return DEVICE_UNKNOWN;
 }
 
+const struct device_desc *device_get_desc(const struct dt_device_node *dev)
+{
+    const struct device_desc *desc;
+
+    ASSERT(dev != NULL);
+
+    for ( desc = _sdevice; desc != _edevice; desc++ )
+    {
+        if ( dt_match_node(desc->dt_match, dev) )
+            return desc;
+    }
+
+    return NULL;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/asm-arm/device.h b/xen/include/asm-arm/device.h
index 6734ae8..1a40a02 100644
--- a/xen/include/asm-arm/device.h
+++ b/xen/include/asm-arm/device.h
@@ -89,6 +89,7 @@ int __init device_init(struct dt_device_node *dev, enum 
device_class class,
  * Return the device type on success or DEVICE_ANY on failure
  */
 enum device_class device_get_class(const struct dt_device_node *dev);
+const struct device_desc *device_get_desc(const struct dt_device_node *dev);
 
 #define DT_DEVICE_START(_name, _namestr, _class)                    \
 static const struct device_desc __dev_desc_##_name __used           \
-- 
2.5.0


_______________________________________________
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®.