Commit c45cf2d4 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Staging: hv: create VMBUS_DEVICE macro and use it.

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: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 283f2129
...@@ -795,16 +795,10 @@ static void blkvsc_request(struct request_queue *queue) ...@@ -795,16 +795,10 @@ static void blkvsc_request(struct request_queue *queue)
} }
static const struct hv_vmbus_device_id id_table[] = { static const struct hv_vmbus_device_id id_table[] = {
{ /* IDE guid */
/* IDE guid */ { VMBUS_DEVICE(0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44,
.guid = { 0x9b, 0x5c, 0x50, 0xd1, 0x41, 0x73, 0x54, 0xf5) },
0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44, { },
0x9b, 0x5c, 0x50, 0xd1, 0x41, 0x73, 0x54, 0xf5
}
},
{
.guid = { }
},
}; };
MODULE_DEVICE_TABLE(vmbus, id_table); MODULE_DEVICE_TABLE(vmbus, id_table);
......
...@@ -909,16 +909,10 @@ static void reportdesc_callback(struct hv_device *dev, void *packet, u32 len) ...@@ -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[] = { static const struct hv_vmbus_device_id id_table[] = {
{ /* Mouse guid */
/* Mouse guid */ { VMBUS_DEVICE(0x9E, 0xB6, 0xA8, 0xCF, 0x4A, 0x5B, 0xc0, 0x4c,
.guid = { 0xB9, 0x8B, 0x8B, 0xA1, 0xA1, 0xF3, 0xF9, 0x5A) },
0x9E, 0xB6, 0xA8, 0xCF, 0x4A, 0x5B, 0xc0, 0x4c, { },
0xB9, 0x8B, 0x8B, 0xA1, 0xA1, 0xF3, 0xF9, 0x5A
}
},
{
.guid = { }
},
}; };
/* /*
......
...@@ -227,37 +227,19 @@ static int util_remove(struct hv_device *dev) ...@@ -227,37 +227,19 @@ static int util_remove(struct hv_device *dev)
} }
static const struct hv_vmbus_device_id id_table[] = { static const struct hv_vmbus_device_id id_table[] = {
{ /* Shutdown guid */
/* Shutdown guid */ { VMBUS_DEVICE(0x31, 0x60, 0x0B, 0X0E, 0x13, 0x52, 0x34, 0x49,
.guid = { 0x81, 0x8B, 0x38, 0XD9, 0x0C, 0xED, 0x39, 0xDB) },
0x31, 0x60, 0x0B, 0X0E, 0x13, 0x52, 0x34, 0x49, /* Time synch guid */
0x81, 0x8B, 0x38, 0XD9, 0x0C, 0xED, 0x39, 0xDB { 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,
/* Time synch guid */ 0xab, 0x55, 0x38, 0x2f, 0x3b, 0xd5, 0x42, 0x2d) },
.guid = { /* KVP guid */
0x30, 0xe6, 0x27, 0x95, 0xae, 0xd0, 0x7b, 0x49, { VMBUS_DEVICE(0xe7, 0xf4, 0xa0, 0xa9, 0x45, 0x5a, 0x96, 0x4d,
0xad, 0xce, 0xe8, 0x0a, 0xb0, 0x17, 0x5c, 0xaf 0xb8, 0x27, 0x8a, 0x84, 0x1e, 0x8c, 0x3, 0xe6) },
} { },
},
{
/* 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 = { }
},
}; };
MODULE_DEVICE_TABLE(vmbus, id_table); MODULE_DEVICE_TABLE(vmbus, id_table);
......
...@@ -848,6 +848,17 @@ static inline struct hv_driver *drv_to_hv_drv(struct device_driver *d) ...@@ -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); int vmbus_child_driver_register(struct device_driver *drv);
void vmbus_child_driver_unregister(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 * Common header for Hyper-V ICs
*/ */
......
...@@ -414,16 +414,10 @@ static int netvsc_remove(struct hv_device *dev) ...@@ -414,16 +414,10 @@ static int netvsc_remove(struct hv_device *dev)
} }
static const struct hv_vmbus_device_id id_table[] = { static const struct hv_vmbus_device_id id_table[] = {
{ /* Network guid */
/* Network guid */ { VMBUS_DEVICE(0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46,
.guid = { 0x91, 0x3F, 0xF2, 0xD2, 0xF9, 0x65, 0xED, 0x0E) },
0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46, { },
0x91, 0x3F, 0xF2, 0xD2, 0xF9, 0x65, 0xED, 0x0E
}
},
{
.guid = { }
},
}; };
MODULE_DEVICE_TABLE(vmbus, id_table); MODULE_DEVICE_TABLE(vmbus, id_table);
......
...@@ -639,16 +639,10 @@ static struct scsi_host_template scsi_driver = { ...@@ -639,16 +639,10 @@ static struct scsi_host_template scsi_driver = {
}; };
static const struct hv_vmbus_device_id id_table[] = { static const struct hv_vmbus_device_id id_table[] = {
{ /* SCSI guid */
/* SCSI guid */ { VMBUS_DEVICE(0xd9, 0x63, 0x61, 0xba, 0xa1, 0x04, 0x29, 0x4d,
.guid = { 0xb6, 0x05, 0x72, 0xe2, 0xff, 0xb1, 0xdc, 0x7f) },
0xd9, 0x63, 0x61, 0xba, 0xa1, 0x04, 0x29, 0x4d, { },
0xb6, 0x05, 0x72, 0xe2, 0xff, 0xb1, 0xdc, 0x7f
}
},
{
.guid = { }
},
}; };
MODULE_DEVICE_TABLE(vmbus, id_table); MODULE_DEVICE_TABLE(vmbus, id_table);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment