mirror of
https://github.com/adulau/aha.git
synced 2024-12-30 20:56:23 +00:00
Staging: hv: coding style cleanups of BlkVsc.c
Cc: Hank Janssen <hjanssen@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
216260d8b8
commit
44c67577b3
1 changed files with 55 additions and 59 deletions
|
@ -19,7 +19,6 @@
|
||||||
* Hank Janssen <hjanssen@microsoft.com>
|
* Hank Janssen <hjanssen@microsoft.com>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
#include "osd.h"
|
#include "osd.h"
|
||||||
|
@ -35,72 +34,26 @@ static const struct hv_guid gBlkVscDeviceType={
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Static routines */
|
static int BlkVscOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo)
|
||||||
static int
|
|
||||||
BlkVscOnDeviceAdd(
|
|
||||||
struct hv_device *Device,
|
|
||||||
void *AdditionalInfo
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
BlkVscInitialize(
|
|
||||||
struct hv_driver *Driver
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
struct storvsc_driver_object *storDriver = (struct storvsc_driver_object *)Driver;
|
struct storvsc_device_info *deviceInfo;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
DPRINT_ENTER(BLKVSC);
|
DPRINT_ENTER(BLKVSC);
|
||||||
|
|
||||||
/* Make sure we are at least 2 pages since 1 page is used for control */
|
deviceInfo = (struct storvsc_device_info *)AdditionalInfo;
|
||||||
ASSERT(storDriver->RingBufferSize >= (PAGE_SIZE << 1));
|
|
||||||
|
|
||||||
Driver->name = gBlkDriverName;
|
|
||||||
memcpy(&Driver->deviceType, &gBlkVscDeviceType, sizeof(struct hv_guid));
|
|
||||||
|
|
||||||
storDriver->RequestExtSize = sizeof(STORVSC_REQUEST_EXTENSION);
|
|
||||||
/* Divide the ring buffer data size (which is 1 page less than the ring buffer size since that page is reserved for the ring buffer indices) */
|
|
||||||
/* by the max request size (which is VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER + struct vstor_packet + u64) */
|
|
||||||
storDriver->MaxOutstandingRequestsPerChannel =
|
|
||||||
((storDriver->RingBufferSize - PAGE_SIZE) / ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET + sizeof(struct vstor_packet) + sizeof(u64),sizeof(u64)));
|
|
||||||
|
|
||||||
DPRINT_INFO(BLKVSC, "max io outstd %u", storDriver->MaxOutstandingRequestsPerChannel);
|
|
||||||
|
|
||||||
/* Setup the dispatch table */
|
|
||||||
storDriver->Base.OnDeviceAdd = BlkVscOnDeviceAdd;
|
|
||||||
storDriver->Base.OnDeviceRemove = StorVscOnDeviceRemove;
|
|
||||||
storDriver->Base.OnCleanup = StorVscOnCleanup;
|
|
||||||
|
|
||||||
storDriver->OnIORequest = StorVscOnIORequest;
|
|
||||||
|
|
||||||
DPRINT_EXIT(BLKVSC);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
BlkVscOnDeviceAdd(
|
|
||||||
struct hv_device *Device,
|
|
||||||
void *AdditionalInfo
|
|
||||||
)
|
|
||||||
{
|
|
||||||
int ret=0;
|
|
||||||
struct storvsc_device_info *deviceInfo = (struct storvsc_device_info *)AdditionalInfo;
|
|
||||||
|
|
||||||
DPRINT_ENTER(BLKVSC);
|
|
||||||
|
|
||||||
ret = StorVscOnDeviceAdd(Device, AdditionalInfo);
|
ret = StorVscOnDeviceAdd(Device, AdditionalInfo);
|
||||||
|
if (ret != 0) {
|
||||||
if (ret != 0)
|
|
||||||
{
|
|
||||||
DPRINT_EXIT(BLKVSC);
|
DPRINT_EXIT(BLKVSC);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We need to use the device instance guid to set the path and target id. For IDE devices, the */
|
/*
|
||||||
/* device instance id is formatted as <bus id> - <device id> - 8899 - 000000000000. */
|
* We need to use the device instance guid to set the path and target
|
||||||
|
* id. For IDE devices, the device instance id is formatted as
|
||||||
|
* <bus id> * - <device id> - 8899 - 000000000000.
|
||||||
|
*/
|
||||||
deviceInfo->PathId = Device->deviceInstance.data[3] << 24 |
|
deviceInfo->PathId = Device->deviceInstance.data[3] << 24 |
|
||||||
Device->deviceInstance.data[2] << 16 |
|
Device->deviceInstance.data[2] << 16 |
|
||||||
Device->deviceInstance.data[1] << 8 |
|
Device->deviceInstance.data[1] << 8 |
|
||||||
|
@ -113,3 +66,46 @@ BlkVscOnDeviceAdd(
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int BlkVscInitialize(struct hv_driver *Driver)
|
||||||
|
{
|
||||||
|
struct storvsc_driver_object *storDriver;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
DPRINT_ENTER(BLKVSC);
|
||||||
|
|
||||||
|
storDriver = (struct storvsc_driver_object *)Driver;
|
||||||
|
|
||||||
|
/* Make sure we are at least 2 pages since 1 page is used for control */
|
||||||
|
ASSERT(storDriver->RingBufferSize >= (PAGE_SIZE << 1));
|
||||||
|
|
||||||
|
Driver->name = gBlkDriverName;
|
||||||
|
memcpy(&Driver->deviceType, &gBlkVscDeviceType, sizeof(struct hv_guid));
|
||||||
|
|
||||||
|
storDriver->RequestExtSize = sizeof(STORVSC_REQUEST_EXTENSION);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Divide the ring buffer data size (which is 1 page less than the ring
|
||||||
|
* buffer size since that page is reserved for the ring buffer indices)
|
||||||
|
* by the max request size (which is
|
||||||
|
* VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER + struct vstor_packet + u64)
|
||||||
|
*/
|
||||||
|
storDriver->MaxOutstandingRequestsPerChannel =
|
||||||
|
((storDriver->RingBufferSize - PAGE_SIZE) /
|
||||||
|
ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET +
|
||||||
|
sizeof(struct vstor_packet) + sizeof(u64),
|
||||||
|
sizeof(u64)));
|
||||||
|
|
||||||
|
DPRINT_INFO(BLKVSC, "max io outstd %u",
|
||||||
|
storDriver->MaxOutstandingRequestsPerChannel);
|
||||||
|
|
||||||
|
/* Setup the dispatch table */
|
||||||
|
storDriver->Base.OnDeviceAdd = BlkVscOnDeviceAdd;
|
||||||
|
storDriver->Base.OnDeviceRemove = StorVscOnDeviceRemove;
|
||||||
|
storDriver->Base.OnCleanup = StorVscOnCleanup;
|
||||||
|
storDriver->OnIORequest = StorVscOnIORequest;
|
||||||
|
|
||||||
|
DPRINT_EXIT(BLKVSC);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue