diff mbox

[Xen-devel,v2,04/12] xen/arm: device: Rename device_type into device_match

Message ID 1421418247-30068-5-git-send-email-julien.grall@linaro.org
State Superseded, archived
Headers show

Commit Message

Julien Grall Jan. 16, 2015, 2:23 p.m. UTC
This enum was used for matching a specific device and not to get the
type of device.

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

Signed-off-by: Julien Grall <julien.grall@linaro.org>
---
 xen/arch/arm/device.c        | 4 ++--
 xen/include/asm-arm/device.h | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

Comments

Julien Grall Jan. 27, 2015, 4:09 p.m. UTC | #1
Hi Stefano,

On 27/01/15 16:05, Stefano Stabellini wrote:
> On Fri, 16 Jan 2015, Julien Grall wrote:
>> This enum was used for matching a specific device and not to get the
>> type of device.
>>
>> Hence the name device_type will be used for another purpose later.
>>
>> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> 
> If you really want to rename this field, please find a more descriptive
> name for it. device_match doesn't really tell me what we are trying to
> match against.  At least device_type would tell me that we are matching
> against the type.

I was struggling to find a correct name. For me device_type refers to
PCI/platform device. And it will be used this way later.

Maybe device_category?

Regards,
Julien Grall Jan. 27, 2015, 10:26 p.m. UTC | #2
On 27/01/2015 16:13, Stefano Stabellini wrote:
> On Tue, 27 Jan 2015, Julien Grall wrote:
>> Hi Stefano,
>>
>> On 27/01/15 16:05, Stefano Stabellini wrote:
>>> On Fri, 16 Jan 2015, Julien Grall wrote:
>>>> This enum was used for matching a specific device and not to get the
>>>> type of device.
>>>>
>>>> Hence the name device_type will be used for another purpose later.
>>>>
>>>> Signed-off-by: Julien Grall <julien.grall@linaro.org>
>>>
>>> If you really want to rename this field, please find a more descriptive
>>> name for it. device_match doesn't really tell me what we are trying to
>>> match against.  At least device_type would tell me that we are matching
>>> against the type.
>>
>> I was struggling to find a correct name. For me device_type refers to
>> PCI/platform device. And it will be used this way later.
>>
>> Maybe device_category?
>
> Yes, or device_class

device_class seems better. I will use it in the next version.

Regards,
diff mbox

Patch

diff --git a/xen/arch/arm/device.c b/xen/arch/arm/device.c
index 59e94c0..693b9af 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_match type,
                        const void *data)
 {
     const struct device_desc *desc;
@@ -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_match device_get_type(const struct dt_device_node *dev)
 {
     const struct device_desc *desc;
 
diff --git a/xen/include/asm-arm/device.h b/xen/include/asm-arm/device.h
index 74a80c6..72a9028 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_match
 {
     DEVICE_SERIAL,
     DEVICE_IOMMU,
@@ -17,7 +17,7 @@  struct device_desc {
     /* Device name */
     const char *name;
     /* Device type */
-    enum device_type type;
+    enum device_match type;
     /* Array of device tree 'compatible' strings */
     const char *const *compatible;
     /* Device initialization */
@@ -32,7 +32,7 @@  struct device_desc {
  *
  *  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_match type,
                        const void *data);
 
 /**
@@ -41,7 +41,7 @@  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_match device_get_type(const struct dt_device_node *dev);
 
 #define DT_DEVICE_START(_name, _namestr, _type)                     \
 static const struct device_desc __dev_desc_##_name __used           \