vmbus_device_unregister(channel->device_obj);
 }
 
+void vmbus_free_channels(void)
+{
+       struct vmbus_channel *channel;
+
+       list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) {
+               vmbus_device_unregister(channel->device_obj);
+               kfree(channel->device_obj);
+               free_channel(channel);
+       }
+}
+
 /*
  * vmbus_process_offer - Process the offer by creating a channel/device
  * associated with this offer
 
 {
        union hv_x64_msr_hypercall_contents hypercall_msr;
 
+       /* Reset our OS id */
+       wrmsrl(HV_X64_MSR_GUEST_OS_ID, 0);
+
        kfree(hv_context.signal_event_buffer);
        hv_context.signal_event_buffer = NULL;
        hv_context.signal_event_param = NULL;
 
 
 struct vmbus_channel *relid2channel(u32 relid);
 
+void vmbus_free_channels(void);
 
 /* Connection interface */
 
 
        return ret;
 }
 
+static void __exit vmbus_exit(void)
+{
+
+       free_irq(irq, hv_acpi_dev);
+       vmbus_free_channels();
+       bus_unregister(&hv_bus);
+       hv_cleanup();
+       acpi_bus_unregister_driver(&vmbus_acpi_driver);
+}
+
 
 MODULE_LICENSE("GPL");
 MODULE_VERSION(HV_DRV_VERSION);
 
 subsys_initcall(hv_acpi_init);
+module_exit(vmbus_exit);