Commit 490707d2 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Staging: hv: coding style cleanups of ChannelInterface.c

Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 44c67577
...@@ -20,199 +20,133 @@ ...@@ -20,199 +20,133 @@
* 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"
#include "VmbusPrivate.h" #include "VmbusPrivate.h"
static int static int IVmbusChannelOpen(struct hv_device *device, u32 SendBufferSize,
IVmbusChannelOpen( u32 RecvRingBufferSize, void *UserData,
struct hv_device *Device, u32 UserDataLen,
u32 SendBufferSize, VMBUS_CHANNEL_CALLBACK ChannelCallback,
u32 RecvRingBufferSize, void *Context)
void * UserData,
u32 UserDataLen,
VMBUS_CHANNEL_CALLBACK ChannelCallback,
void * Context
)
{ {
return VmbusChannelOpen((struct vmbus_channel *)Device->context, return VmbusChannelOpen(device->context, SendBufferSize,
SendBufferSize, RecvRingBufferSize, UserData, UserDataLen,
RecvRingBufferSize, ChannelCallback, Context);
UserData,
UserDataLen,
ChannelCallback,
Context);
} }
static void IVmbusChannelClose(struct hv_device *device)
static void
IVmbusChannelClose(
struct hv_device *Device
)
{ {
VmbusChannelClose((struct vmbus_channel *)Device->context); VmbusChannelClose(device->context);
} }
static int IVmbusChannelSendPacket(struct hv_device *device, const void *Buffer,
static int u32 BufferLen, u64 RequestId, u32 Type,
IVmbusChannelSendPacket( u32 Flags)
struct hv_device *Device,
const void * Buffer,
u32 BufferLen,
u64 RequestId,
u32 Type,
u32 Flags
)
{ {
return VmbusChannelSendPacket((struct vmbus_channel *)Device->context, return VmbusChannelSendPacket(device->context, Buffer, BufferLen,
Buffer, RequestId, Type, Flags);
BufferLen,
RequestId,
Type,
Flags);
} }
static int static int IVmbusChannelSendPacketPageBuffer(struct hv_device *device,
IVmbusChannelSendPacketPageBuffer( struct hv_page_buffer PageBuffers[],
struct hv_device *Device, u32 PageCount, void *Buffer,
struct hv_page_buffer PageBuffers[], u32 BufferLen, u64 RequestId)
u32 PageCount,
void * Buffer,
u32 BufferLen,
u64 RequestId
)
{ {
return VmbusChannelSendPacketPageBuffer((struct vmbus_channel *)Device->context, return VmbusChannelSendPacketPageBuffer(device->context, PageBuffers,
PageBuffers, PageCount, Buffer, BufferLen,
PageCount, RequestId);
Buffer,
BufferLen,
RequestId);
} }
static int static int IVmbusChannelSendPacketMultiPageBuffer(struct hv_device *device,
IVmbusChannelSendPacketMultiPageBuffer( struct hv_multipage_buffer *MultiPageBuffer,
struct hv_device *Device, void *Buffer, u32 BufferLen, u64 RequestId)
struct hv_multipage_buffer *MultiPageBuffer,
void * Buffer,
u32 BufferLen,
u64 RequestId
)
{ {
return VmbusChannelSendPacketMultiPageBuffer((struct vmbus_channel *)Device->context, return VmbusChannelSendPacketMultiPageBuffer(device->context,
MultiPageBuffer, MultiPageBuffer, Buffer,
Buffer, BufferLen, RequestId);
BufferLen,
RequestId);
} }
static int static int IVmbusChannelRecvPacket(struct hv_device *device, void *Buffer,
IVmbusChannelRecvPacket ( u32 BufferLen, u32 *BufferActualLen,
struct hv_device *Device, u64 *RequestId)
void * Buffer,
u32 BufferLen,
u32* BufferActualLen,
u64* RequestId
)
{ {
return VmbusChannelRecvPacket((struct vmbus_channel *)Device->context, return VmbusChannelRecvPacket(device->context, Buffer, BufferLen,
Buffer, BufferActualLen, RequestId);
BufferLen,
BufferActualLen,
RequestId);
} }
static int static int IVmbusChannelRecvPacketRaw(struct hv_device *device, void *Buffer,
IVmbusChannelRecvPacketRaw( u32 BufferLen, u32 *BufferActualLen,
struct hv_device *Device, u64 *RequestId)
void * Buffer,
u32 BufferLen,
u32* BufferActualLen,
u64* RequestId
)
{ {
return VmbusChannelRecvPacketRaw((struct vmbus_channel *)Device->context, return VmbusChannelRecvPacketRaw(device->context, Buffer, BufferLen,
Buffer, BufferActualLen, RequestId);
BufferLen,
BufferActualLen,
RequestId);
} }
static int static int IVmbusChannelEstablishGpadl(struct hv_device *device, void *Buffer,
IVmbusChannelEstablishGpadl( u32 BufferLen, u32 *GpadlHandle)
struct hv_device *Device,
void * Buffer,
u32 BufferLen,
u32* GpadlHandle
)
{ {
return VmbusChannelEstablishGpadl((struct vmbus_channel *)Device->context, return VmbusChannelEstablishGpadl(device->context, Buffer, BufferLen,
Buffer, GpadlHandle);
BufferLen,
GpadlHandle);
} }
static int static int IVmbusChannelTeardownGpadl(struct hv_device *device, u32 GpadlHandle)
IVmbusChannelTeardownGpadl(
struct hv_device *Device,
u32 GpadlHandle
)
{ {
return VmbusChannelTeardownGpadl((struct vmbus_channel *)Device->context, return VmbusChannelTeardownGpadl(device->context, GpadlHandle);
GpadlHandle);
} }
void GetChannelInterface(struct vmbus_channel_interface *ChannelInterface) void GetChannelInterface(struct vmbus_channel_interface *iface)
{ {
ChannelInterface->Open = IVmbusChannelOpen; iface->Open = IVmbusChannelOpen;
ChannelInterface->Close = IVmbusChannelClose; iface->Close = IVmbusChannelClose;
ChannelInterface->SendPacket = IVmbusChannelSendPacket; iface->SendPacket = IVmbusChannelSendPacket;
ChannelInterface->SendPacketPageBuffer = IVmbusChannelSendPacketPageBuffer; iface->SendPacketPageBuffer = IVmbusChannelSendPacketPageBuffer;
ChannelInterface->SendPacketMultiPageBuffer = IVmbusChannelSendPacketMultiPageBuffer; iface->SendPacketMultiPageBuffer =
ChannelInterface->RecvPacket = IVmbusChannelRecvPacket; IVmbusChannelSendPacketMultiPageBuffer;
ChannelInterface->RecvPacketRaw = IVmbusChannelRecvPacketRaw; iface->RecvPacket = IVmbusChannelRecvPacket;
ChannelInterface->EstablishGpadl = IVmbusChannelEstablishGpadl; iface->RecvPacketRaw = IVmbusChannelRecvPacketRaw;
ChannelInterface->TeardownGpadl = IVmbusChannelTeardownGpadl; iface->EstablishGpadl = IVmbusChannelEstablishGpadl;
ChannelInterface->GetInfo = GetChannelInfo; iface->TeardownGpadl = IVmbusChannelTeardownGpadl;
iface->GetInfo = GetChannelInfo;
} }
void GetChannelInfo(struct hv_device *device, struct hv_device_info *info)
void GetChannelInfo(struct hv_device *Device, struct hv_device_info *DeviceInfo)
{ {
struct vmbus_channel_debug_info debugInfo; struct vmbus_channel_debug_info debugInfo;
if (Device->context) if (!device->context)
{ return;
VmbusChannelGetDebugInfo((struct vmbus_channel *)Device->context, &debugInfo);
VmbusChannelGetDebugInfo(device->context, &debugInfo);
DeviceInfo->ChannelId = debugInfo.RelId;
DeviceInfo->ChannelState = debugInfo.State; info->ChannelId = debugInfo.RelId;
memcpy(&DeviceInfo->ChannelType, &debugInfo.InterfaceType, sizeof(struct hv_guid)); info->ChannelState = debugInfo.State;
memcpy(&DeviceInfo->ChannelInstance, &debugInfo.InterfaceInstance, sizeof(struct hv_guid)); memcpy(&info->ChannelType, &debugInfo.InterfaceType,
sizeof(struct hv_guid));
DeviceInfo->MonitorId = debugInfo.MonitorId; memcpy(&info->ChannelInstance, &debugInfo.InterfaceInstance,
sizeof(struct hv_guid));
DeviceInfo->ServerMonitorPending = debugInfo.ServerMonitorPending;
DeviceInfo->ServerMonitorLatency = debugInfo.ServerMonitorLatency; info->MonitorId = debugInfo.MonitorId;
DeviceInfo->ServerMonitorConnectionId = debugInfo.ServerMonitorConnectionId;
info->ServerMonitorPending = debugInfo.ServerMonitorPending;
DeviceInfo->ClientMonitorPending = debugInfo.ClientMonitorPending; info->ServerMonitorLatency = debugInfo.ServerMonitorLatency;
DeviceInfo->ClientMonitorLatency = debugInfo.ClientMonitorLatency; info->ServerMonitorConnectionId = debugInfo.ServerMonitorConnectionId;
DeviceInfo->ClientMonitorConnectionId = debugInfo.ClientMonitorConnectionId;
info->ClientMonitorPending = debugInfo.ClientMonitorPending;
DeviceInfo->Inbound.InterruptMask = debugInfo.Inbound.CurrentInterruptMask; info->ClientMonitorLatency = debugInfo.ClientMonitorLatency;
DeviceInfo->Inbound.ReadIndex = debugInfo.Inbound.CurrentReadIndex; info->ClientMonitorConnectionId = debugInfo.ClientMonitorConnectionId;
DeviceInfo->Inbound.WriteIndex = debugInfo.Inbound.CurrentWriteIndex;
DeviceInfo->Inbound.BytesAvailToRead = debugInfo.Inbound.BytesAvailToRead; info->Inbound.InterruptMask = debugInfo.Inbound.CurrentInterruptMask;
DeviceInfo->Inbound.BytesAvailToWrite = debugInfo.Inbound.BytesAvailToWrite; info->Inbound.ReadIndex = debugInfo.Inbound.CurrentReadIndex;
info->Inbound.WriteIndex = debugInfo.Inbound.CurrentWriteIndex;
DeviceInfo->Outbound.InterruptMask = debugInfo.Outbound.CurrentInterruptMask; info->Inbound.BytesAvailToRead = debugInfo.Inbound.BytesAvailToRead;
DeviceInfo->Outbound.ReadIndex = debugInfo.Outbound.CurrentReadIndex; info->Inbound.BytesAvailToWrite = debugInfo.Inbound.BytesAvailToWrite;
DeviceInfo->Outbound.WriteIndex = debugInfo.Outbound.CurrentWriteIndex;
DeviceInfo->Outbound.BytesAvailToRead = debugInfo.Outbound.BytesAvailToRead; info->Outbound.InterruptMask = debugInfo.Outbound.CurrentInterruptMask;
DeviceInfo->Outbound.BytesAvailToWrite = debugInfo.Outbound.BytesAvailToWrite; info->Outbound.ReadIndex = debugInfo.Outbound.CurrentReadIndex;
} info->Outbound.WriteIndex = debugInfo.Outbound.CurrentWriteIndex;
info->Outbound.BytesAvailToRead = debugInfo.Outbound.BytesAvailToRead;
info->Outbound.BytesAvailToWrite = debugInfo.Outbound.BytesAvailToWrite;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment