From 46a0525385f59872e16d5d0962ba3e488fb18165 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 17 Aug 2009 17:21:31 -0700 Subject: [PATCH] Staging: hv: cleanup coding style issues in Channel.h Cc: Hank Janssen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/hv/Channel.c | 38 +++--- drivers/staging/hv/Channel.h | 267 ++++++++++++++++++------------------------- 2 files changed, 129 insertions(+), 176 deletions(-) rewrite drivers/staging/hv/Channel.h (63%) diff --git a/drivers/staging/hv/Channel.c b/drivers/staging/hv/Channel.c index 2938e588de9..89ddbf1c83b 100644 --- a/drivers/staging/hv/Channel.c +++ b/drivers/staging/hv/Channel.c @@ -159,7 +159,7 @@ Description: Retrieve various channel debug info --*/ -static void +void VmbusChannelGetDebugInfo( VMBUS_CHANNEL *Channel, VMBUS_CHANNEL_DEBUG_INFO *DebugInfo @@ -203,7 +203,7 @@ Description: Open the specified channel. --*/ -static int +int VmbusChannelOpen( VMBUS_CHANNEL *NewChannel, u32 SendRingBufferSize, @@ -516,7 +516,7 @@ Description: Estabish a GPADL for the specified buffer --*/ -static int +int VmbusChannelEstablishGpadl( VMBUS_CHANNEL *Channel, void * Kbuffer, /* from kmalloc() */ @@ -621,7 +621,7 @@ Description: Teardown the specified GPADL handle --*/ -static int +int VmbusChannelTeardownGpadl( VMBUS_CHANNEL *Channel, u32 GpadlHandle @@ -682,7 +682,7 @@ Description: Close the specified channel --*/ -static void +void VmbusChannelClose( VMBUS_CHANNEL *Channel ) @@ -759,7 +759,7 @@ Description: Send the specified buffer on the given channel --*/ -static int +int VmbusChannelSendPacket( VMBUS_CHANNEL *Channel, const void * Buffer, @@ -821,7 +821,7 @@ Description: Send a range of single-page buffer packets using a GPADL Direct packet type. --*/ -static int +int VmbusChannelSendPacketPageBuffer( VMBUS_CHANNEL *Channel, PAGE_BUFFER PageBuffers[], @@ -900,7 +900,7 @@ Description: Send a multi-page buffer packet using a GPADL Direct packet type. --*/ -static int +int VmbusChannelSendPacketMultiPageBuffer( VMBUS_CHANNEL *Channel, MULTIPAGE_BUFFER *MultiPageBuffer, @@ -979,14 +979,11 @@ Description: --*/ /* TODO: Do we ever receive a gpa direct packet other than the ones we send ? */ -static int -VmbusChannelRecvPacket( - VMBUS_CHANNEL *Channel, - void * Buffer, - u32 BufferLen, - u32* BufferActualLen, - u64* RequestId - ) +int VmbusChannelRecvPacket(VMBUS_CHANNEL *Channel, + void *Buffer, + u32 BufferLen, + u32 *BufferActualLen, + u64 *RequestId) { VMPACKET_DESCRIPTOR desc; u32 packetLen; @@ -1057,7 +1054,7 @@ Description: Retrieve the raw packet on the specified channel --*/ -static int +int VmbusChannelRecvPacketRaw( VMBUS_CHANNEL *Channel, void * Buffer, @@ -1134,10 +1131,7 @@ Description: Channel event callback --*/ -static void -VmbusChannelOnChannelEvent( - VMBUS_CHANNEL *Channel - ) +void VmbusChannelOnChannelEvent(VMBUS_CHANNEL *Channel) { DumpVmbusChannel(Channel); ASSERT(Channel->OnChannelCallback); @@ -1160,7 +1154,7 @@ Description: Timer event callback --*/ -static void VmbusChannelOnTimer(unsigned long data) +void VmbusChannelOnTimer(unsigned long data) { VMBUS_CHANNEL *channel = (VMBUS_CHANNEL*)data; diff --git a/drivers/staging/hv/Channel.h b/drivers/staging/hv/Channel.h dissimilarity index 63% index 16d6e7d886f..4fc5baf297d 100644 --- a/drivers/staging/hv/Channel.h +++ b/drivers/staging/hv/Channel.h @@ -1,154 +1,113 @@ -/* - * - * Copyright (c) 2009, Microsoft Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place - Suite 330, Boston, MA 02111-1307 USA. - * - * Authors: - * Haiyang Zhang - * Hank Janssen - * - */ - - -#ifndef _CHANNEL_H_ -#define _CHANNEL_H_ - -#include "include/osd.h" -#include "ChannelMgmt.h" - -#pragma pack(push,1) - - -/* The format must be the same as VMDATA_GPA_DIRECT */ -struct VMBUS_CHANNEL_PACKET_PAGE_BUFFER { - u16 Type; - u16 DataOffset8; - u16 Length8; - u16 Flags; - u64 TransactionId; - u32 Reserved; - u32 RangeCount; - PAGE_BUFFER Range[MAX_PAGE_BUFFER_COUNT]; -}; - - -/* The format must be the same as VMDATA_GPA_DIRECT */ -struct VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER { - u16 Type; - u16 DataOffset8; - u16 Length8; - u16 Flags; - u64 TransactionId; - u32 Reserved; - u32 RangeCount; /* Always 1 in this case */ - MULTIPAGE_BUFFER Range; -}; - -#pragma pack(pop) - - -/* Routines */ - - -static int -VmbusChannelOpen( - VMBUS_CHANNEL *Channel, - u32 SendRingBufferSize, - u32 RecvRingBufferSize, - void * UserData, - u32 UserDataLen, - PFN_CHANNEL_CALLBACK pfnOnChannelCallback, - void * Context - ); - -static void -VmbusChannelClose( - VMBUS_CHANNEL *Channel - ); - -static int -VmbusChannelSendPacket( - VMBUS_CHANNEL *Channel, - const void * Buffer, - u32 BufferLen, - u64 RequestId, - VMBUS_PACKET_TYPE Type, - u32 Flags -); - -static int -VmbusChannelSendPacketPageBuffer( - VMBUS_CHANNEL *Channel, - PAGE_BUFFER PageBuffers[], - u32 PageCount, - void * Buffer, - u32 BufferLen, - u64 RequestId - ); - -static int -VmbusChannelSendPacketMultiPageBuffer( - VMBUS_CHANNEL *Channel, - MULTIPAGE_BUFFER *MultiPageBuffer, - void * Buffer, - u32 BufferLen, - u64 RequestId -); - -static int -VmbusChannelEstablishGpadl( - VMBUS_CHANNEL *Channel, - void * Kbuffer, /* from kmalloc() */ - u32 Size, /* page-size multiple */ - u32 *GpadlHandle - ); - -static int -VmbusChannelTeardownGpadl( - VMBUS_CHANNEL *Channel, - u32 GpadlHandle - ); - -static int -VmbusChannelRecvPacket( - VMBUS_CHANNEL *Channel, - void * Buffer, - u32 BufferLen, - u32* BufferActualLen, - u64* RequestId - ); - -static int -VmbusChannelRecvPacketRaw( - VMBUS_CHANNEL *Channel, - void * Buffer, - u32 BufferLen, - u32* BufferActualLen, - u64* RequestId - ); - -static void -VmbusChannelOnChannelEvent( - VMBUS_CHANNEL *Channel - ); - -static void -VmbusChannelGetDebugInfo( - VMBUS_CHANNEL *Channel, - VMBUS_CHANNEL_DEBUG_INFO *DebugInfo - ); - -static void VmbusChannelOnTimer(unsigned long data); -#endif /* _CHANNEL_H_ */ +/* + * + * Copyright (c) 2009, Microsoft Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307 USA. + * + * Authors: + * Haiyang Zhang + * Hank Janssen + * + */ + + +#ifndef _CHANNEL_H_ +#define _CHANNEL_H_ + +#include "include/osd.h" +#include "ChannelMgmt.h" + +/* The format must be the same as VMDATA_GPA_DIRECT */ +struct VMBUS_CHANNEL_PACKET_PAGE_BUFFER { + u16 Type; + u16 DataOffset8; + u16 Length8; + u16 Flags; + u64 TransactionId; + u32 Reserved; + u32 RangeCount; + PAGE_BUFFER Range[MAX_PAGE_BUFFER_COUNT]; +} __attribute__((packed)); + +/* The format must be the same as VMDATA_GPA_DIRECT */ +struct VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER { + u16 Type; + u16 DataOffset8; + u16 Length8; + u16 Flags; + u64 TransactionId; + u32 Reserved; + u32 RangeCount; /* Always 1 in this case */ + MULTIPAGE_BUFFER Range; +} __attribute__((packed)); + + +extern int VmbusChannelOpen(VMBUS_CHANNEL *Channel, + u32 SendRingBufferSize, + u32 RecvRingBufferSize, + void *UserData, + u32 UserDataLen, + PFN_CHANNEL_CALLBACK pfnOnChannelCallback, + void *Context); + +extern void VmbusChannelClose(VMBUS_CHANNEL *Channel); + +extern int VmbusChannelSendPacket(VMBUS_CHANNEL *Channel, + const void *Buffer, + u32 BufferLen, + u64 RequestId, + VMBUS_PACKET_TYPE Type, + u32 Flags); + +extern int VmbusChannelSendPacketPageBuffer(VMBUS_CHANNEL *Channel, + PAGE_BUFFER PageBuffers[], + u32 PageCount, + void *Buffer, + u32 BufferLen, + u64 RequestId); + +extern int VmbusChannelSendPacketMultiPageBuffer(VMBUS_CHANNEL *Channel, + MULTIPAGE_BUFFER *MultiPageBuffer, + void *Buffer, + u32 BufferLen, + u64 RequestId); + +extern int VmbusChannelEstablishGpadl(VMBUS_CHANNEL *Channel, + void *Kbuffer, + u32 Size, + u32 *GpadlHandle); + +extern int VmbusChannelTeardownGpadl(VMBUS_CHANNEL *Channel, + u32 GpadlHandle); + +extern int VmbusChannelRecvPacket(VMBUS_CHANNEL *Channel, + void *Buffer, + u32 BufferLen, + u32 *BufferActualLen, + u64 *RequestId); + +extern int VmbusChannelRecvPacketRaw(VMBUS_CHANNEL *Channel, + void *Buffer, + u32 BufferLen, + u32 *BufferActualLen, + u64 *RequestId); + +extern void VmbusChannelOnChannelEvent(VMBUS_CHANNEL *Channel); + +extern void VmbusChannelGetDebugInfo(VMBUS_CHANNEL *Channel, + VMBUS_CHANNEL_DEBUG_INFO *DebugInfo); + +extern void VmbusChannelOnTimer(unsigned long data); + +#endif /* _CHANNEL_H_ */ -- 2.11.4.GIT