Skip to content

Commit

Permalink
Staging: hv: util: Make hv_utils a vmbus device driver
Browse files Browse the repository at this point in the history
In preperation for supporting auto-loading the util driver, make
the util driver a vmbus driver.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
K. Y. Srinivasan authored and Greg Kroah-Hartman committed Aug 25, 2011
1 parent 1ec91eb commit 283f212
Showing 1 changed file with 63 additions and 1 deletion.
64 changes: 63 additions & 1 deletion drivers/staging/hv/hv_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 283f212

Please sign in to comment.