Commit 3523a805 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Staging: hv: cleanup coding style issues in RingBuffer.h

Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent f346fdc2
...@@ -203,8 +203,7 @@ GetRingBufferIndices(RING_BUFFER_INFO* RingInfo) ...@@ -203,8 +203,7 @@ GetRingBufferIndices(RING_BUFFER_INFO* RingInfo)
Dump out to console the ring buffer info Dump out to console the ring buffer info
--*/ --*/
static void void DumpRingInfo(RING_BUFFER_INFO *RingInfo, char *Prefix)
DumpRingInfo(RING_BUFFER_INFO* RingInfo, char *Prefix)
{ {
u32 bytesAvailToWrite; u32 bytesAvailToWrite;
u32 bytesAvailToRead; u32 bytesAvailToRead;
...@@ -249,11 +248,8 @@ CopyFromRingBuffer( ...@@ -249,11 +248,8 @@ CopyFromRingBuffer(
Get various debug metrics for the specified ring buffer Get various debug metrics for the specified ring buffer
--*/ --*/
static void void RingBufferGetDebugInfo(RING_BUFFER_INFO *RingInfo,
RingBufferGetDebugInfo( RING_BUFFER_DEBUG_INFO *DebugInfo)
RING_BUFFER_INFO *RingInfo,
RING_BUFFER_DEBUG_INFO *DebugInfo
)
{ {
u32 bytesAvailToWrite; u32 bytesAvailToWrite;
u32 bytesAvailToRead; u32 bytesAvailToRead;
...@@ -281,10 +277,7 @@ RingBufferGetDebugInfo( ...@@ -281,10 +277,7 @@ RingBufferGetDebugInfo(
Get the interrupt mask for the specified ring buffer Get the interrupt mask for the specified ring buffer
--*/ --*/
static u32 u32 GetRingBufferInterruptMask(RING_BUFFER_INFO *rbi)
GetRingBufferInterruptMask(
RING_BUFFER_INFO *rbi
)
{ {
return rbi->RingBuffer->InterruptMask; return rbi->RingBuffer->InterruptMask;
} }
...@@ -298,12 +291,7 @@ GetRingBufferInterruptMask( ...@@ -298,12 +291,7 @@ GetRingBufferInterruptMask(
Initialize the ring buffer Initialize the ring buffer
--*/ --*/
static int int RingBufferInit(RING_BUFFER_INFO *RingInfo, void *Buffer, u32 BufferLen)
RingBufferInit(
RING_BUFFER_INFO *RingInfo,
void *Buffer,
u32 BufferLen
)
{ {
ASSERT(sizeof(RING_BUFFER) == PAGE_SIZE); ASSERT(sizeof(RING_BUFFER) == PAGE_SIZE);
...@@ -329,10 +317,7 @@ RingBufferInit( ...@@ -329,10 +317,7 @@ RingBufferInit(
Cleanup the ring buffer Cleanup the ring buffer
--*/ --*/
static void void RingBufferCleanup(RING_BUFFER_INFO* RingInfo)
RingBufferCleanup(
RING_BUFFER_INFO* RingInfo
)
{ {
} }
...@@ -345,12 +330,8 @@ RingBufferCleanup( ...@@ -345,12 +330,8 @@ RingBufferCleanup(
Write to the ring buffer Write to the ring buffer
--*/ --*/
static int int RingBufferWrite(RING_BUFFER_INFO *OutRingInfo,
RingBufferWrite( struct scatterlist *sglist, u32 sgcount)
RING_BUFFER_INFO *OutRingInfo,
struct scatterlist *sglist,
u32 sgcount
)
{ {
int i=0; int i=0;
u32 byteAvailToWrite; u32 byteAvailToWrite;
...@@ -436,12 +417,7 @@ RingBufferWrite( ...@@ -436,12 +417,7 @@ RingBufferWrite(
Read without advancing the read index Read without advancing the read index
--*/ --*/
static int int RingBufferPeek(RING_BUFFER_INFO *InRingInfo, void *Buffer, u32 BufferLen)
RingBufferPeek(
RING_BUFFER_INFO* InRingInfo,
void* Buffer,
u32 BufferLen
)
{ {
u32 bytesAvailToWrite; u32 bytesAvailToWrite;
u32 bytesAvailToRead; u32 bytesAvailToRead;
...@@ -485,13 +461,8 @@ RingBufferPeek( ...@@ -485,13 +461,8 @@ RingBufferPeek(
Read and advance the read index Read and advance the read index
--*/ --*/
static int int RingBufferRead(RING_BUFFER_INFO *InRingInfo, void *Buffer,
RingBufferRead( u32 BufferLen, u32 Offset)
RING_BUFFER_INFO* InRingInfo,
void * Buffer,
u32 BufferLen,
u32 Offset
)
{ {
u32 bytesAvailToWrite; u32 bytesAvailToWrite;
u32 bytesAvailToRead; u32 bytesAvailToRead;
......
...@@ -30,91 +30,74 @@ ...@@ -30,91 +30,74 @@
#include "include/osd.h" #include "include/osd.h"
typedef struct _RING_BUFFER { typedef struct _RING_BUFFER {
volatile u32 WriteIndex; /* Offset in bytes from the start of ring data below */ /* Offset in bytes from the start of ring data below */
volatile u32 ReadIndex; /* Offset in bytes from the start of ring data below */ volatile u32 WriteIndex;
/* Offset in bytes from the start of ring data below */
volatile u32 ReadIndex;
volatile u32 InterruptMask; volatile u32 InterruptMask;
u8 Reserved[4084]; /* Pad it to PAGE_SIZE so that data starts on page boundary */
/* NOTE: The InterruptMask field is used only for channels but since our vmbus connection */ /* Pad it to PAGE_SIZE so that data starts on page boundary */
/* also uses this data structure and its data starts here, we commented out this field. */ u8 Reserved[4084];
/* NOTE:
* The InterruptMask field is used only for channels but since our
* vmbus connection also uses this data structure and its data starts
* here, we commented out this field.
*/
/* volatile u32 InterruptMask; */ /* volatile u32 InterruptMask; */
/* Ring data starts here + RingDataStartOffset !!! DO NOT place any fields below this !!! */
u8 Buffer[0]; /*
* Ring data starts here + RingDataStartOffset
* !!! DO NOT place any fields below this !!!
*/
u8 Buffer[0];
} __attribute__((packed)) RING_BUFFER; } __attribute__((packed)) RING_BUFFER;
typedef struct _RING_BUFFER_INFO { typedef struct _RING_BUFFER_INFO {
RING_BUFFER* RingBuffer; RING_BUFFER *RingBuffer;
u32 RingSize; /* Include the shared header */ u32 RingSize; /* Include the shared header */
spinlock_t ring_lock; spinlock_t ring_lock;
u32 RingDataSize; /* < ringSize */ u32 RingDataSize; /* < ringSize */
u32 RingDataStartOffset; u32 RingDataStartOffset;
} RING_BUFFER_INFO; } RING_BUFFER_INFO;
typedef struct _RING_BUFFER_DEBUG_INFO { typedef struct _RING_BUFFER_DEBUG_INFO {
u32 CurrentInterruptMask; u32 CurrentInterruptMask;
u32 CurrentReadIndex; u32 CurrentReadIndex;
u32 CurrentWriteIndex; u32 CurrentWriteIndex;
u32 BytesAvailToRead; u32 BytesAvailToRead;
u32 BytesAvailToWrite; u32 BytesAvailToWrite;
}RING_BUFFER_DEBUG_INFO; } RING_BUFFER_DEBUG_INFO;
/* Interface */ /* Interface */
static int int RingBufferInit(RING_BUFFER_INFO *RingInfo, void *Buffer, u32 BufferLen);
RingBufferInit(
RING_BUFFER_INFO *RingInfo, void RingBufferCleanup(RING_BUFFER_INFO *RingInfo);
void * Buffer,
u32 BufferLen int RingBufferWrite(RING_BUFFER_INFO *RingInfo,
); struct scatterlist *sglist,
u32 sgcount);
static void
RingBufferCleanup( int RingBufferPeek(RING_BUFFER_INFO *RingInfo, void *Buffer, u32 BufferLen);
RING_BUFFER_INFO *RingInfo
); int RingBufferRead(RING_BUFFER_INFO *RingInfo,
void *Buffer,
static int u32 BufferLen,
RingBufferWrite( u32 Offset);
RING_BUFFER_INFO *RingInfo,
struct scatterlist *sglist, u32 GetRingBufferInterruptMask(RING_BUFFER_INFO *RingInfo);
u32 sgcount
); void DumpRingInfo(RING_BUFFER_INFO *RingInfo, char *Prefix);
static int void RingBufferGetDebugInfo(RING_BUFFER_INFO *RingInfo,
RingBufferPeek( RING_BUFFER_DEBUG_INFO *DebugInfo);
RING_BUFFER_INFO *RingInfo,
void * Buffer,
u32 BufferLen
);
static int
RingBufferRead(
RING_BUFFER_INFO *RingInfo,
void * Buffer,
u32 BufferLen,
u32 Offset
);
static u32
GetRingBufferInterruptMask(
RING_BUFFER_INFO *RingInfo
);
static void
DumpRingInfo(
RING_BUFFER_INFO* RingInfo,
char *Prefix
);
static void
RingBufferGetDebugInfo(
RING_BUFFER_INFO *RingInfo,
RING_BUFFER_DEBUG_INFO *DebugInfo
);
#endif /* _RING_BUFFER_H_ */ #endif /* _RING_BUFFER_H_ */
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