diff mbox

[Xen-devel,v3,04/13] xen/arm: device: Rename device_type into device_class

Message ID 1422643768-23614-5-git-send-email-julien.grall@linaro.org
State Accepted, archived
Headers show

Commit Message

Julien Grall Jan. 30, 2015, 6:49 p.m. UTC
This enum was used for matching a specific class of device and not to get the
type of device.

Hence the name device_type will be used for another purpose later.

Also rename device_get_type into device_get_class to reflect the change.

Signed-off-by: Julien Grall <julien.grall@linaro.org>

---
    Changes in v3:
        - Use device_class rather than device_match
        - Rename device_get_type to device_class
---
 xen/arch/arm/device.c        |  8 ++++----
 xen/arch/arm/domain_build.c  |  2 +-
 xen/include/asm-arm/device.h | 16 ++++++++--------
 3 files changed, 13 insertions(+), 13 deletions(-)
diff mbox

Patch

diff --git a/xen/arch/arm/device.c b/xen/arch/arm/device.c
index 59e94c0..1f9dbf7 100644
--- a/xen/arch/arm/device.c
+++ b/xen/arch/arm/device.c
@@ -40,7 +40,7 @@  static bool_t __init device_is_compatible(const struct device_desc *desc,
     return 0;
 }
 
-int __init device_init(struct dt_device_node *dev, enum device_type type,
+int __init device_init(struct dt_device_node *dev, enum device_class class,
                        const void *data)
 {
     const struct device_desc *desc;
@@ -52,7 +52,7 @@  int __init device_init(struct dt_device_node *dev, enum device_type type,
 
     for ( desc = _sdevice; desc != _edevice; desc++ )
     {
-        if ( desc->type != type )
+        if ( desc->class != class )
             continue;
 
         if ( device_is_compatible(desc, dev) )
@@ -67,7 +67,7 @@  int __init device_init(struct dt_device_node *dev, enum device_type type,
     return -EBADF;
 }
 
-enum device_type device_get_type(const struct dt_device_node *dev)
+enum device_class device_get_class(const struct dt_device_node *dev)
 {
     const struct device_desc *desc;
 
@@ -76,7 +76,7 @@  enum device_type device_get_type(const struct dt_device_node *dev)
     for ( desc = _sdevice; desc != _edevice; desc++ )
     {
         if ( device_is_compatible(desc, dev) )
-            return desc->type;
+            return desc->class;
     }
 
     return DEVICE_UNKNOWN;
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index c2dcb49..7b923e0 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1084,7 +1084,7 @@  static int handle_node(struct domain *d, struct kernel_info *kinfo,
     /* Even if the IOMMU device is not used by Xen, it should not be
      * passthrough to DOM0
      */
-    if ( device_get_type(node) == DEVICE_IOMMU )
+    if ( device_get_class(node) == DEVICE_IOMMU )
     {
         DPRINT(" IOMMU, skip it\n");
         return 0;
diff --git a/xen/include/asm-arm/device.h b/xen/include/asm-arm/device.h
index 74a80c6..b6b32bc 100644
--- a/xen/include/asm-arm/device.h
+++ b/xen/include/asm-arm/device.h
@@ -4,7 +4,7 @@ 
 #include <xen/init.h>
 #include <xen/device_tree.h>
 
-enum device_type
+enum device_class
 {
     DEVICE_SERIAL,
     DEVICE_IOMMU,
@@ -16,8 +16,8 @@  enum device_type
 struct device_desc {
     /* Device name */
     const char *name;
-    /* Device type */
-    enum device_type type;
+    /* Device class */
+    enum device_class class;
     /* Array of device tree 'compatible' strings */
     const char *const *compatible;
     /* Device initialization */
@@ -27,12 +27,12 @@  struct device_desc {
 /**
  *  device_init - Initialize a device
  *  @dev: device to initialize
- *  @type: type of the device (serial, network...)
+ *  @class: class of the device (serial, network...)
  *  @data: specific data for initializing the device
  *
  *  Return 0 on success.
  */
-int __init device_init(struct dt_device_node *dev, enum device_type type,
+int __init device_init(struct dt_device_node *dev, enum device_class class,
                        const void *data);
 
 /**
@@ -41,13 +41,13 @@  int __init device_init(struct dt_device_node *dev, enum device_type type,
  *
  * Return the device type on success or DEVICE_ANY on failure
  */
-enum device_type device_get_type(const struct dt_device_node *dev);
+enum device_class device_get_class(const struct dt_device_node *dev);
 
-#define DT_DEVICE_START(_name, _namestr, _type)                     \
+#define DT_DEVICE_START(_name, _namestr, _class)                    \
 static const struct device_desc __dev_desc_##_name __used           \
 __attribute__((__section__(".dev.info"))) = {                       \
     .name = _namestr,                                               \
-    .type = _type,                                                  \
+    .class = _class,                                                \
 
 #define DT_DEVICE_END                                               \
 };