diff options
-rw-r--r-- | drivers/hv/channel_mgmt.c | 11 | ||||
-rw-r--r-- | drivers/hv/hv.c | 3 | ||||
-rw-r--r-- | drivers/hv/hyperv_vmbus.h | 1 | ||||
-rw-r--r-- | drivers/hv/vmbus_drv.c | 11 |
4 files changed, 26 insertions, 0 deletions
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index b91af50875e9..36484db36baf 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c | |||
@@ -223,6 +223,17 @@ static void vmbus_process_rescind_offer(struct work_struct *work) | |||
223 | vmbus_device_unregister(channel->device_obj); | 223 | vmbus_device_unregister(channel->device_obj); |
224 | } | 224 | } |
225 | 225 | ||
226 | void vmbus_free_channels(void) | ||
227 | { | ||
228 | struct vmbus_channel *channel; | ||
229 | |||
230 | list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) { | ||
231 | vmbus_device_unregister(channel->device_obj); | ||
232 | kfree(channel->device_obj); | ||
233 | free_channel(channel); | ||
234 | } | ||
235 | } | ||
236 | |||
226 | /* | 237 | /* |
227 | * vmbus_process_offer - Process the offer by creating a channel/device | 238 | * vmbus_process_offer - Process the offer by creating a channel/device |
228 | * associated with this offer | 239 | * associated with this offer |
diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c index 0fb100ed91a3..f8a77d01a516 100644 --- a/drivers/hv/hv.c +++ b/drivers/hv/hv.c | |||
@@ -237,6 +237,9 @@ void hv_cleanup(void) | |||
237 | { | 237 | { |
238 | union hv_x64_msr_hypercall_contents hypercall_msr; | 238 | union hv_x64_msr_hypercall_contents hypercall_msr; |
239 | 239 | ||
240 | /* Reset our OS id */ | ||
241 | wrmsrl(HV_X64_MSR_GUEST_OS_ID, 0); | ||
242 | |||
240 | kfree(hv_context.signal_event_buffer); | 243 | kfree(hv_context.signal_event_buffer); |
241 | hv_context.signal_event_buffer = NULL; | 244 | hv_context.signal_event_buffer = NULL; |
242 | hv_context.signal_event_param = NULL; | 245 | hv_context.signal_event_param = NULL; |
diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h index 0aee1122734c..6d7d286d5440 100644 --- a/drivers/hv/hyperv_vmbus.h +++ b/drivers/hv/hyperv_vmbus.h | |||
@@ -611,6 +611,7 @@ void vmbus_device_unregister(struct hv_device *device_obj); | |||
611 | 611 | ||
612 | struct vmbus_channel *relid2channel(u32 relid); | 612 | struct vmbus_channel *relid2channel(u32 relid); |
613 | 613 | ||
614 | void vmbus_free_channels(void); | ||
614 | 615 | ||
615 | /* Connection interface */ | 616 | /* Connection interface */ |
616 | 617 | ||
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 40956d1c6608..c3875f72b5bf 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c | |||
@@ -795,8 +795,19 @@ cleanup: | |||
795 | return ret; | 795 | return ret; |
796 | } | 796 | } |
797 | 797 | ||
798 | static void __exit vmbus_exit(void) | ||
799 | { | ||
800 | |||
801 | free_irq(irq, hv_acpi_dev); | ||
802 | vmbus_free_channels(); | ||
803 | bus_unregister(&hv_bus); | ||
804 | hv_cleanup(); | ||
805 | acpi_bus_unregister_driver(&vmbus_acpi_driver); | ||
806 | } | ||
807 | |||
798 | 808 | ||
799 | MODULE_LICENSE("GPL"); | 809 | MODULE_LICENSE("GPL"); |
800 | MODULE_VERSION(HV_DRV_VERSION); | 810 | MODULE_VERSION(HV_DRV_VERSION); |
801 | 811 | ||
802 | subsys_initcall(hv_acpi_init); | 812 | subsys_initcall(hv_acpi_init); |
813 | module_exit(vmbus_exit); | ||