Staging: hv: create VMBUS_DEVICE macro and use it.
authorGreg Kroah-Hartman <gregkh@suse.de>
Thu, 25 Aug 2011 18:41:33 +0000 (11:41 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 25 Aug 2011 18:41:33 +0000 (11:41 -0700)
This is to be used to be able to write hv_vmbus_device_id tables easier.

This patch also converts all hv drivers to use the macro, saving some
lines of code and making things easier to read overall.

Cc: K. Y. Srinivasan <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/hv/blkvsc_drv.c
drivers/staging/hv/hv_mouse.c
drivers/staging/hv/hv_util.c
drivers/staging/hv/hyperv.h
drivers/staging/hv/netvsc_drv.c
drivers/staging/hv/storvsc_drv.c

index 9b99387d98cc4ddf0a2aba473abccc120eef2b92..d170f24a07fe862ee151813b8d9a48dc06a5ebd2 100644 (file)
@@ -795,16 +795,10 @@ static void blkvsc_request(struct request_queue *queue)
 }
 
 static const struct hv_vmbus_device_id id_table[] = {
-       {
-               /* IDE guid */
-               .guid = {
-                       0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44,
-                       0x9b, 0x5c, 0x50, 0xd1, 0x41, 0x73, 0x54, 0xf5
-               }
-       },
-       {
-               .guid = { }
-       },
+       /* IDE guid */
+       { VMBUS_DEVICE(0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44,
+                      0x9b, 0x5c, 0x50, 0xd1, 0x41, 0x73, 0x54, 0xf5) },
+       { },
 };
 
 MODULE_DEVICE_TABLE(vmbus, id_table);
index dd8a1143b35b0e2a8c176332f3932ca88081aa42..ebd17150d6c3a7cff063a16063cc413dce9aa2c5 100644 (file)
@@ -909,16 +909,10 @@ static void reportdesc_callback(struct hv_device *dev, void *packet, u32 len)
 }
 
 static const struct hv_vmbus_device_id id_table[] = {
-       {
-               /* Mouse guid */
-               .guid = {
-                       0x9E, 0xB6, 0xA8, 0xCF, 0x4A, 0x5B, 0xc0, 0x4c,
-                       0xB9, 0x8B, 0x8B, 0xA1, 0xA1, 0xF3, 0xF9, 0x5A
-               }
-       },
-       {
-               .guid = { }
-       },
+       /* Mouse guid */
+       { VMBUS_DEVICE(0x9E, 0xB6, 0xA8, 0xCF, 0x4A, 0x5B, 0xc0, 0x4c,
+                      0xB9, 0x8B, 0x8B, 0xA1, 0xA1, 0xF3, 0xF9, 0x5A) },
+       { },
 };
 
 /*
index a620f4d810c9172e0163510a1ca33f7d9719aa9f..5bd6f00b8242e7b6a4b996d9245c4c9ca5ef7e36 100644 (file)
@@ -227,37 +227,19 @@ static int util_remove(struct hv_device *dev)
 }
 
 static const struct hv_vmbus_device_id id_table[] = {
-       {
-               /* Shutdown guid */
-               .guid = {
-                       0x31, 0x60, 0x0B, 0X0E, 0x13, 0x52, 0x34, 0x49,
-                       0x81, 0x8B, 0x38, 0XD9, 0x0C, 0xED, 0x39, 0xDB
-               }
-       },
-       {
-               /* Time synch guid */
-               .guid = {
-                       0x30, 0xe6, 0x27, 0x95, 0xae, 0xd0, 0x7b, 0x49,
-                       0xad, 0xce, 0xe8, 0x0a, 0xb0, 0x17, 0x5c, 0xaf
-               }
-       },
-       {
-               /* Heartbeat guid */
-               .guid = {
-                       0x39, 0x4f, 0x16, 0x57, 0x15, 0x91, 0x78, 0x4e,
-                       0xab, 0x55, 0x38, 0x2f, 0x3b, 0xd5, 0x42, 0x2d
-               }
-       },
-       {
-               /* KVP guid */
-               .guid = {
-                       0xe7, 0xf4, 0xa0, 0xa9, 0x45, 0x5a, 0x96, 0x4d,
-                       0xb8, 0x27, 0x8a, 0x84, 0x1e, 0x8c, 0x3,  0xe6
-               }
-       },
-       {
-               .guid = { }
-       },
+       /* Shutdown guid */
+       { VMBUS_DEVICE(0x31, 0x60, 0x0B, 0X0E, 0x13, 0x52, 0x34, 0x49,
+                      0x81, 0x8B, 0x38, 0XD9, 0x0C, 0xED, 0x39, 0xDB) },
+       /* Time synch guid */
+       { VMBUS_DEVICE(0x30, 0xe6, 0x27, 0x95, 0xae, 0xd0, 0x7b, 0x49,
+                      0xad, 0xce, 0xe8, 0x0a, 0xb0, 0x17, 0x5c, 0xaf) },
+       /* Heartbeat guid */
+       { VMBUS_DEVICE(0x39, 0x4f, 0x16, 0x57, 0x15, 0x91, 0x78, 0x4e,
+                      0xab, 0x55, 0x38, 0x2f, 0x3b, 0xd5, 0x42, 0x2d) },
+       /* KVP guid */
+       { VMBUS_DEVICE(0xe7, 0xf4, 0xa0, 0xa9, 0x45, 0x5a, 0x96, 0x4d,
+                      0xb8, 0x27, 0x8a, 0x84, 0x1e, 0x8c, 0x3,  0xe6) },
+       { },
 };
 
 MODULE_DEVICE_TABLE(vmbus, id_table);
index b8199f4b4aed7734565988cb25668c0f25a728af..d96de668eb139cbd84266bf81118ddc2cfd47c6a 100644 (file)
@@ -848,6 +848,17 @@ static inline struct hv_driver *drv_to_hv_drv(struct device_driver *d)
 int vmbus_child_driver_register(struct device_driver *drv);
 void vmbus_child_driver_unregister(struct device_driver *drv);
 
+/**
+ * VMBUS_DEVICE - macro used to describe a specific hyperv vmbus device
+ *
+ * This macro is used to create a struct hv_vmbus_device_id that matches a
+ * specific device.
+ */
+#define VMBUS_DEVICE(g0, g1, g2, g3, g4, g5, g6, g7,   \
+                    g8, g9, ga, gb, gc, gd, ge, gf)    \
+       .guid = { g0, g1, g2, g3, g4, g5, g6, g7,       \
+                 g8, g9, ga, gb, gc, gd, ge, gf },
+
 /*
  * Common header for Hyper-V ICs
  */
index 2e25c957cfd006efbdbf32cae8f196073b75ea97..c3b7de1470042fe985801621305d7a5ca97c8978 100644 (file)
@@ -414,16 +414,10 @@ static int netvsc_remove(struct hv_device *dev)
 }
 
 static const struct hv_vmbus_device_id id_table[] = {
-       {
-               /* Network guid */
-               .guid = {
-                       0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46,
-                       0x91, 0x3F, 0xF2, 0xD2, 0xF9, 0x65, 0xED, 0x0E
-               }
-       },
-       {
-               .guid = { }
-       },
+       /* Network guid */
+       { VMBUS_DEVICE(0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46,
+                      0x91, 0x3F, 0xF2, 0xD2, 0xF9, 0x65, 0xED, 0x0E) },
+       { },
 };
 
 MODULE_DEVICE_TABLE(vmbus, id_table);
index ed2140c01543e40aac51eb00a5f4af587489ac9f..f85f2ea23743c116ba520b3283c8b074afdfc933 100644 (file)
@@ -639,16 +639,10 @@ static struct scsi_host_template scsi_driver = {
 };
 
 static const struct hv_vmbus_device_id id_table[] = {
-       {
-               /* SCSI guid */
-               .guid = {
-                       0xd9, 0x63, 0x61, 0xba, 0xa1, 0x04, 0x29, 0x4d,
-                       0xb6, 0x05, 0x72, 0xe2, 0xff, 0xb1, 0xdc, 0x7f
-               }
-       },
-       {
-               .guid = { }
-       },
+       /* SCSI guid */
+       { VMBUS_DEVICE(0xd9, 0x63, 0x61, 0xba, 0xa1, 0x04, 0x29, 0x4d,
+                      0xb6, 0x05, 0x72, 0xe2, 0xff, 0xb1, 0xdc, 0x7f) },
+       { },
 };
 
 MODULE_DEVICE_TABLE(vmbus, id_table);