Commit d750785f authored by Haiyang Zhang's avatar Haiyang Zhang Committed by Greg Kroah-Hartman

Staging: hv: fix hv_utils module to properly autoload

Added autoloading based on pci id and dmi strings.
Signed-off-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: default avatarHank Janssen <hjanssen@microsoft.com>
Cc: stable <stable@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 8b5d6d3b
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/sysctl.h> #include <linux/sysctl.h>
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/dmi.h>
#include <linux/pci.h>
#include "logging.h" #include "logging.h"
#include "osd.h" #include "osd.h"
...@@ -251,10 +253,36 @@ static void heartbeat_onchannelcallback(void *context) ...@@ -251,10 +253,36 @@ static void heartbeat_onchannelcallback(void *context)
DPRINT_EXIT(VMBUS); DPRINT_EXIT(VMBUS);
} }
static const struct pci_device_id __initconst
hv_utils_pci_table[] __maybe_unused = {
{ PCI_DEVICE(0x1414, 0x5353) }, /* Hyper-V emulated VGA controller */
{ 0 }
};
MODULE_DEVICE_TABLE(pci, hv_utils_pci_table);
static const struct dmi_system_id __initconst
hv_utils_dmi_table[] __maybe_unused = {
{
.ident = "Hyper-V",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
DMI_MATCH(DMI_BOARD_NAME, "Virtual Machine"),
},
},
{ },
};
MODULE_DEVICE_TABLE(dmi, hv_utils_dmi_table);
static int __init init_hyperv_utils(void) static int __init init_hyperv_utils(void)
{ {
printk(KERN_INFO "Registering HyperV Utility Driver\n"); printk(KERN_INFO "Registering HyperV Utility Driver\n");
if (!dmi_check_system(hv_utils_dmi_table))
return -ENODEV;
hv_cb_utils[HV_SHUTDOWN_MSG].channel->OnChannelCallback = hv_cb_utils[HV_SHUTDOWN_MSG].channel->OnChannelCallback =
&shutdown_onchannelcallback; &shutdown_onchannelcallback;
hv_cb_utils[HV_SHUTDOWN_MSG].callback = &shutdown_onchannelcallback; hv_cb_utils[HV_SHUTDOWN_MSG].callback = &shutdown_onchannelcallback;
......
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