diff options
author | Haiyang Zhang <haiyangz@microsoft.com> | 2010-05-19 11:56:28 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-06-30 11:18:15 -0400 |
commit | d750785f305e03669757678c24cb4e6e8761edf0 (patch) | |
tree | f38f08861ca00dcc5e2f4177920905f3315b3d02 /drivers/staging | |
parent | 8b5d6d3bd3e34e4cc67d875c8c88007c1c9aa960 (diff) |
Staging: hv: fix hv_utils module to properly autoload
Added autoloading based on pci id and dmi strings.
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/hv/hv_utils.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/staging/hv/hv_utils.c b/drivers/staging/hv/hv_utils.c index 8a49aafea37a..2adc9b48ca9c 100644 --- a/drivers/staging/hv/hv_utils.c +++ b/drivers/staging/hv/hv_utils.c | |||
@@ -24,6 +24,8 @@ | |||
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/sysctl.h> | 25 | #include <linux/sysctl.h> |
26 | #include <linux/reboot.h> | 26 | #include <linux/reboot.h> |
27 | #include <linux/dmi.h> | ||
28 | #include <linux/pci.h> | ||
27 | 29 | ||
28 | #include "logging.h" | 30 | #include "logging.h" |
29 | #include "osd.h" | 31 | #include "osd.h" |
@@ -251,10 +253,36 @@ static void heartbeat_onchannelcallback(void *context) | |||
251 | DPRINT_EXIT(VMBUS); | 253 | DPRINT_EXIT(VMBUS); |
252 | } | 254 | } |
253 | 255 | ||
256 | static const struct pci_device_id __initconst | ||
257 | hv_utils_pci_table[] __maybe_unused = { | ||
258 | { PCI_DEVICE(0x1414, 0x5353) }, /* Hyper-V emulated VGA controller */ | ||
259 | { 0 } | ||
260 | }; | ||
261 | MODULE_DEVICE_TABLE(pci, hv_utils_pci_table); | ||
262 | |||
263 | |||
264 | static const struct dmi_system_id __initconst | ||
265 | hv_utils_dmi_table[] __maybe_unused = { | ||
266 | { | ||
267 | .ident = "Hyper-V", | ||
268 | .matches = { | ||
269 | DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), | ||
270 | DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"), | ||
271 | DMI_MATCH(DMI_BOARD_NAME, "Virtual Machine"), | ||
272 | }, | ||
273 | }, | ||
274 | { }, | ||
275 | }; | ||
276 | MODULE_DEVICE_TABLE(dmi, hv_utils_dmi_table); | ||
277 | |||
278 | |||
254 | static int __init init_hyperv_utils(void) | 279 | static int __init init_hyperv_utils(void) |
255 | { | 280 | { |
256 | printk(KERN_INFO "Registering HyperV Utility Driver\n"); | 281 | printk(KERN_INFO "Registering HyperV Utility Driver\n"); |
257 | 282 | ||
283 | if (!dmi_check_system(hv_utils_dmi_table)) | ||
284 | return -ENODEV; | ||
285 | |||
258 | hv_cb_utils[HV_SHUTDOWN_MSG].channel->OnChannelCallback = | 286 | hv_cb_utils[HV_SHUTDOWN_MSG].channel->OnChannelCallback = |
259 | &shutdown_onchannelcallback; | 287 | &shutdown_onchannelcallback; |
260 | hv_cb_utils[HV_SHUTDOWN_MSG].callback = &shutdown_onchannelcallback; | 288 | hv_cb_utils[HV_SHUTDOWN_MSG].callback = &shutdown_onchannelcallback; |