提交 283f2129 编写于 作者: K K. Y. Srinivasan 提交者: Greg Kroah-Hartman

Staging: hv: util: Make hv_utils a vmbus device driver

In preperation for supporting auto-loading the util driver, make
the util driver a vmbus driver.
Signed-off-by: NK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: NHaiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 1ec91ebe
......@@ -36,6 +36,8 @@ static u8 *shut_txf_buf;
static u8 *time_txf_buf;
static u8 *hbeat_txf_buf;
static const char *driver_name = "hv_util";
static void shutdown_onchannelcallback(void *context)
{
struct vmbus_channel *channel = context;
......@@ -210,6 +212,63 @@ static void heartbeat_onchannelcallback(void *context)
}
}
/*
* The devices managed by the util driver don't need any additional
* setup.
*/
static int util_probe(struct hv_device *dev)
{
return 0;
}
static int util_remove(struct hv_device *dev)
{
return 0;
}
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 = { }
},
};
MODULE_DEVICE_TABLE(vmbus, id_table);
/* The one and only one */
static struct hv_driver util_drv = {
.id_table = id_table,
.probe = util_probe,
.remove = util_remove,
};
static const struct pci_device_id __initconst
hv_utils_pci_table[] __maybe_unused = {
{ PCI_DEVICE(0x1414, 0x5353) }, /* Hyper-V emulated VGA controller */
......@@ -264,7 +323,9 @@ static int __init init_hyperv_utils(void)
hv_cb_utils[HV_KVP_MSG].callback = &hv_kvp_onchannelcallback;
return 0;
util_drv.driver.name = driver_name;
return vmbus_child_driver_register(&util_drv.driver);
}
static void exit_hyperv_utils(void)
......@@ -296,6 +357,7 @@ static void exit_hyperv_utils(void)
kfree(shut_txf_buf);
kfree(time_txf_buf);
kfree(hbeat_txf_buf);
vmbus_child_driver_unregister(&util_drv.driver);
}
module_init(init_hyperv_utils);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册