/* StorVscOnDeviceRemove - Callback when the our device is being removed  */
static int StorVscOnDeviceRemove(struct hv_device *Device)
/* StorVscOnDeviceRemove - Callback when the our device is being removed  */
static int StorVscOnDeviceRemove(struct hv_device *Device)
{
	struct storvsc_device *storDevice;
	DPRINT_ENTER(STORVSC);
	DPRINT_INFO(STORVSC, "disabling storage device (%p)...",
		    Device->Extension);
	storDevice = ReleaseStorDevice(Device);
	while (atomic_read(&storDevice->NumOutstandingRequests)) {
		DPRINT_INFO(STORVSC, "waiting for %d requests to complete...",
			    atomic_read(&storDevice->NumOutstandingRequests));
		udelay(100);
	}
	DPRINT_INFO(STORVSC, "removing storage device (%p)...",
		    Device->Extension);
	storDevice = FinalReleaseStorDevice(Device);
	DPRINT_INFO(STORVSC, "storage device (%p) safe to remove", storDevice);
	Device->Driver->VmbusChannelInterface.Close(Device);
	FreeStorDevice(storDevice);
	DPRINT_EXIT(STORVSC);
	return 0;
}