Now, based on the newly introduved id_table, cleanup the 
vmbus_match function. This mechanism will also permit us to handle
multiple device types using a common driver.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
---
 drivers/staging/hv/vmbus_drv.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index cbb80ec..0e1a13c 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -250,16 +250,16 @@ static int vmbus_uevent(struct device *device, struct 
kobj_uevent_env *env)
  */
 static int vmbus_match(struct device *device, struct device_driver *driver)
 {
-       int match = 0;
        struct hv_driver *drv = drv_to_hv_drv(driver);
        struct hv_device *hv_dev = device_to_hv_device(device);
+       const struct hv_vmbus_device_id *id_array = drv->id_table;
 
-       /* We found our driver ? */
-       if (memcmp(&hv_dev->dev_type, &drv->dev_type,
-                  sizeof(struct hv_guid)) == 0)
-               match = 1;
+       for (; *id_array->device_type != '\0'; id_array++) {
+               if (!strcmp(id_array->device_type, hv_dev->device_type))
+                       return 1;
+       }
 
-       return match;
+       return 0;
 }
 
 /*
-- 
1.7.4.1

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel

Reply via email to