From c45cf2d4976e2fcde68d88898a37af70f2caaf5d Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 25 Aug 2011 11:41:33 -0700 Subject: [PATCH] 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 Cc: Haiyang Zhang Signed-off-by: Greg Kroah-Hartman --- drivers/staging/hv/blkvsc_drv.c | 14 +++------- drivers/staging/hv/hv_mouse.c | 14 +++------- drivers/staging/hv/hv_util.c | 44 ++++++++++---------------------- drivers/staging/hv/hyperv.h | 11 ++++++++ drivers/staging/hv/netvsc_drv.c | 14 +++------- drivers/staging/hv/storvsc_drv.c | 14 +++------- 6 files changed, 40 insertions(+), 71 deletions(-) diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c index 9b99387d98cc..d170f24a07fe 100644 --- a/drivers/staging/hv/blkvsc_drv.c +++ b/drivers/staging/hv/blkvsc_drv.c @@ -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); diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c index dd8a1143b35b..ebd17150d6c3 100644 --- a/drivers/staging/hv/hv_mouse.c +++ b/drivers/staging/hv/hv_mouse.c @@ -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) }, + { }, }; /* diff --git a/drivers/staging/hv/hv_util.c b/drivers/staging/hv/hv_util.c index a620f4d810c9..5bd6f00b8242 100644 --- a/drivers/staging/hv/hv_util.c +++ b/drivers/staging/hv/hv_util.c @@ -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); diff --git a/drivers/staging/hv/hyperv.h b/drivers/staging/hv/hyperv.h index b8199f4b4aed..d96de668eb13 100644 --- a/drivers/staging/hv/hyperv.h +++ b/drivers/staging/hv/hyperv.h @@ -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 */ diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c index 2e25c957cfd0..c3b7de147004 100644 --- a/drivers/staging/hv/netvsc_drv.c +++ b/drivers/staging/hv/netvsc_drv.c @@ -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); diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c index ed2140c01543..f85f2ea23743 100644 --- a/drivers/staging/hv/storvsc_drv.c +++ b/drivers/staging/hv/storvsc_drv.c @@ -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); -- 2.20.1