Skip to content

Commit

Permalink
Staging: epl: remove INLINE mess
Browse files Browse the repository at this point in the history
extern inline isn't the nicest and it doesn't really make sense.
So unwind all the INLINE defines and includes, if speed is _really_ an
issue later stuff can be put back in a sane manner.

Cc: Daniel Krueger <daniel.krueger@systec-electronic.com>
Cc: Ronald Sieber <Ronald.Sieber@systec-electronic.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Greg Kroah-Hartman committed Apr 3, 2009
1 parent 54e49dd commit 563b125
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 202 deletions.
21 changes: 0 additions & 21 deletions drivers/staging/epl/EplAmi.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,6 @@
extern "C" {
#endif

#if (TARGET_SYSTEM == _LINUX_)
#if defined(__m68k__) // it is an big endian machine
#if defined(INLINE_FUNCTION_DEF)
#undef INLINE_FUNCTION
#define INLINE_FUNCTION INLINE_FUNCTION_DEF
#define INLINE_ENABLED TRUE
#define EPL_AMI_INLINED
#include "../EplStack/amibe.c"
#endif
#endif
#endif

//---------------------------------------------------------------------------
//
// write functions
Expand All @@ -127,12 +115,10 @@ extern "C" {
#define AmiSetByteToBe(pAddr_p, bByteVal_p) {*(BYTE FAR*)(pAddr_p) = (bByteVal_p);}
#define AmiSetByteToLe(pAddr_p, bByteVal_p) {*(BYTE FAR*)(pAddr_p) = (bByteVal_p);}

#if !defined(INLINE_ENABLED)
void AmiSetWordToBe(void FAR *pAddr_p, WORD wWordVal_p);
void AmiSetDwordToBe(void FAR *pAddr_p, DWORD dwDwordVal_p);
void AmiSetWordToLe(void FAR *pAddr_p, WORD wWordVal_p);
void AmiSetDwordToLe(void FAR *pAddr_p, DWORD dwDwordVal_p);
#endif

//---------------------------------------------------------------------------
//
Expand All @@ -145,8 +131,6 @@ void AmiSetDwordToLe(void FAR *pAddr_p, DWORD dwDwordVal_p);
#define AmiGetByteFromBe(pAddr_p) (*(BYTE FAR*)(pAddr_p))
#define AmiGetByteFromLe(pAddr_p) (*(BYTE FAR*)(pAddr_p))

#if !defined(INLINE_ENABLED)

WORD AmiGetWordFromBe(void FAR *pAddr_p);
DWORD AmiGetDwordFromBe(void FAR *pAddr_p);
WORD AmiGetWordFromLe(void FAR *pAddr_p);
Expand Down Expand Up @@ -337,11 +321,6 @@ void AmiSetTimeOfDay(void FAR *pAddr_p, tTimeOfDay FAR *pTimeOfDay_p);
//---------------------------------------------------------------------------
void AmiGetTimeOfDay(void FAR *pAddr_p, tTimeOfDay FAR *pTimeOfDay_p);

#endif

#undef INLINE_ENABLED // disable actual inlining of functions
#define EPL_AMI_INCLUDED

#ifdef __cplusplus
}
#endif
Expand Down
102 changes: 36 additions & 66 deletions drivers/staging/epl/SharedBuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
// d.k. Linux kernel modules needs other header files for memcpy()
#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
#include <linux/string.h>
#include <linux/kernel.h>
#else
#include <stdio.h>
#include <stdlib.h>
Expand All @@ -102,8 +103,6 @@
/* */
/***************************************************************************/

#if (!defined(SHAREDBUFF_INLINED)) || defined(INLINE_ENABLED)

//---------------------------------------------------------------------------
// Configuration
//---------------------------------------------------------------------------
Expand Down Expand Up @@ -177,7 +176,7 @@ typedef struct {
// Get pointer to Circular Shared Buffer
//---------------------------------------------------------------------------

INLINE_FUNCTION tShbCirBuff *ShbCirGetBuffer(tShbInstance pShbInstance_p)
tShbCirBuff *ShbCirGetBuffer(tShbInstance pShbInstance_p)
{

tShbCirBuff *pShbCirBuff;
Expand All @@ -193,7 +192,7 @@ INLINE_FUNCTION tShbCirBuff *ShbCirGetBuffer(tShbInstance pShbInstance_p)
// Get pointer to Linear Shared Buffer
//---------------------------------------------------------------------------

INLINE_FUNCTION tShbLinBuff *ShbLinGetBuffer(tShbInstance pShbInstance_p)
tShbLinBuff *ShbLinGetBuffer(tShbInstance pShbInstance_p)
{

tShbLinBuff *pShbLinBuff;
Expand All @@ -210,15 +209,13 @@ int ShbCirSignalHandlerNewData(tShbInstance pShbInstance_p);
void ShbCirSignalHandlerReset(tShbInstance pShbInstance_p,
unsigned int fTimeOut_p);

#endif

//=========================================================================//
// //
// P U B L I C F U N C T I O N S //
// //
//=========================================================================//

#if !defined(INLINE_ENABLED)
// not inlined external functions

//---------------------------------------------------------------------------
Expand Down Expand Up @@ -363,18 +360,13 @@ tShbError ShbCirReleaseBuffer(tShbInstance pShbInstance_p)

}

#endif // !defined(INLINE_ENABLED)

#if (!defined(SHAREDBUFF_INLINED)) || defined(INLINE_ENABLED)

//---------------------------------------------------------------------------
// Reset Circular Shared Buffer
//---------------------------------------------------------------------------

INLINE_FUNCTION tShbError ShbCirResetBuffer(tShbInstance pShbInstance_p,
unsigned long ulTimeOut_p,
tShbCirSigHndlrReset
pfnSignalHandlerReset_p)
tShbError ShbCirResetBuffer(tShbInstance pShbInstance_p,
unsigned long ulTimeOut_p,
tShbCirSigHndlrReset pfnSignalHandlerReset_p)
{

tShbCirBuff *pShbCirBuff;
Expand Down Expand Up @@ -440,9 +432,9 @@ INLINE_FUNCTION tShbError ShbCirResetBuffer(tShbInstance pShbInstance_p,
// Write data block to Circular Shared Buffer
//---------------------------------------------------------------------------

INLINE_FUNCTION tShbError ShbCirWriteDataBlock(tShbInstance pShbInstance_p,
const void *pSrcDataBlock_p,
unsigned long ulDataBlockSize_p)
tShbError ShbCirWriteDataBlock(tShbInstance pShbInstance_p,
const void *pSrcDataBlock_p,
unsigned long ulDataBlockSize_p)
{

tShbCirBuff *pShbCirBuff;
Expand Down Expand Up @@ -608,9 +600,9 @@ INLINE_FUNCTION tShbError ShbCirWriteDataBlock(tShbInstance pShbInstance_p,
// Allocate block within the Circular Shared Buffer for chunk writing
//---------------------------------------------------------------------------

INLINE_FUNCTION tShbError ShbCirAllocDataBlock(tShbInstance pShbInstance_p,
tShbCirChunk * pShbCirChunk_p,
unsigned long ulDataBufferSize_p)
tShbError ShbCirAllocDataBlock(tShbInstance pShbInstance_p,
tShbCirChunk * pShbCirChunk_p,
unsigned long ulDataBufferSize_p)
{

tShbCirBuff *pShbCirBuff;
Expand Down Expand Up @@ -717,12 +709,11 @@ INLINE_FUNCTION tShbError ShbCirAllocDataBlock(tShbInstance pShbInstance_p,
// Write data chunk into an allocated buffer of the Circular Shared Buffer
//---------------------------------------------------------------------------

INLINE_FUNCTION tShbError ShbCirWriteDataChunk(tShbInstance pShbInstance_p,
tShbCirChunk * pShbCirChunk_p,
const void *pSrcDataChunk_p,
unsigned long ulDataChunkSize_p,
unsigned int
*pfBufferCompleted_p)
tShbError ShbCirWriteDataChunk(tShbInstance pShbInstance_p,
tShbCirChunk *pShbCirChunk_p,
const void *pSrcDataChunk_p,
unsigned long ulDataChunkSize_p,
unsigned int *pfBufferCompleted_p)
{

tShbCirBuff *pShbCirBuff;
Expand Down Expand Up @@ -857,10 +848,10 @@ INLINE_FUNCTION tShbError ShbCirWriteDataChunk(tShbInstance pShbInstance_p,
// Read data block from Circular Shared Buffer
//---------------------------------------------------------------------------

INLINE_FUNCTION tShbError ShbCirReadDataBlock(tShbInstance pShbInstance_p,
void *pDstDataBlock_p,
unsigned long ulRdBuffSize_p,
unsigned long *pulDataBlockSize_p)
tShbError ShbCirReadDataBlock(tShbInstance pShbInstance_p,
void *pDstDataBlock_p,
unsigned long ulRdBuffSize_p,
unsigned long *pulDataBlockSize_p)
{

tShbCirBuff *pShbCirBuff;
Expand Down Expand Up @@ -1009,9 +1000,8 @@ INLINE_FUNCTION tShbError ShbCirReadDataBlock(tShbInstance pShbInstance_p,
// Get data size of next readable block from Circular Shared Buffer
//---------------------------------------------------------------------------

INLINE_FUNCTION tShbError ShbCirGetReadDataSize(tShbInstance pShbInstance_p,
unsigned long
*pulDataBlockSize_p)
tShbError ShbCirGetReadDataSize(tShbInstance pShbInstance_p,
unsigned long *pulDataBlockSize_p)
{

tShbCirBuff *pShbCirBuff;
Expand Down Expand Up @@ -1070,9 +1060,8 @@ INLINE_FUNCTION tShbError ShbCirGetReadDataSize(tShbInstance pShbInstance_p,
// Get number of readable blocks from Circular Shared Buffer
//---------------------------------------------------------------------------

INLINE_FUNCTION tShbError ShbCirGetReadBlockCount(tShbInstance pShbInstance_p,
unsigned long
*pulDataBlockCount_p)
tShbError ShbCirGetReadBlockCount(tShbInstance pShbInstance_p,
unsigned long *pulDataBlockCount_p)
{

tShbCirBuff *pShbCirBuff;
Expand Down Expand Up @@ -1113,12 +1102,9 @@ INLINE_FUNCTION tShbError ShbCirGetReadBlockCount(tShbInstance pShbInstance_p,
// d.k.: new parameter priority as enum
//---------------------------------------------------------------------------

INLINE_FUNCTION tShbError ShbCirSetSignalHandlerNewData(tShbInstance
pShbInstance_p,
tShbCirSigHndlrNewData
pfnSignalHandlerNewData_p,
tShbPriority
ShbPriority_p)
tShbError ShbCirSetSignalHandlerNewData(tShbInstance pShbInstance_p,
tShbCirSigHndlrNewData pfnSignalHandlerNewData_p,
tShbPriority ShbPriority_p)
{

tShbCirBuff *pShbCirBuff;
Expand Down Expand Up @@ -1165,10 +1151,6 @@ INLINE_FUNCTION tShbError ShbCirSetSignalHandlerNewData(tShbInstance

}

#endif

#if !defined(INLINE_ENABLED)

//---------------------------------------------------------------------------
// DEBUG: Trace Circular Shared Buffer
//---------------------------------------------------------------------------
Expand Down Expand Up @@ -1413,18 +1395,13 @@ tShbError ShbLinReleaseBuffer(tShbInstance pShbInstance_p)

}

#endif // !defined(INLINE_ENABLED)

#if (!defined(SHAREDBUFF_INLINED)) || defined(INLINE_ENABLED)

//---------------------------------------------------------------------------
// Write data block to Linear Shared Buffer
//---------------------------------------------------------------------------

INLINE_FUNCTION tShbError ShbLinWriteDataBlock(tShbInstance pShbInstance_p,
unsigned long ulDstBufferOffs_p,
const void *pSrcDataBlock_p,
unsigned long ulDataBlockSize_p)
tShbError ShbLinWriteDataBlock(tShbInstance pShbInstance_p,
unsigned long ulDstBufferOffs_p,
const void *pSrcDataBlock_p,
unsigned long ulDataBlockSize_p)
{

tShbLinBuff *pShbLinBuff;
Expand Down Expand Up @@ -1489,11 +1466,10 @@ INLINE_FUNCTION tShbError ShbLinWriteDataBlock(tShbInstance pShbInstance_p,
//---------------------------------------------------------------------------
// Read data block from Linear Shared Buffer
//---------------------------------------------------------------------------

INLINE_FUNCTION tShbError ShbLinReadDataBlock(tShbInstance pShbInstance_p,
void *pDstDataBlock_p,
unsigned long ulSrcBufferOffs_p,
unsigned long ulDataBlockSize_p)
tShbError ShbLinReadDataBlock(tShbInstance pShbInstance_p,
void *pDstDataBlock_p,
unsigned long ulSrcBufferOffs_p,
unsigned long ulDataBlockSize_p)
{

tShbLinBuff *pShbLinBuff;
Expand Down Expand Up @@ -1555,10 +1531,6 @@ INLINE_FUNCTION tShbError ShbLinReadDataBlock(tShbInstance pShbInstance_p,

}

#endif

#if !defined(INLINE_ENABLED)

//---------------------------------------------------------------------------
// DEBUG: Trace Linear Shared Buffer
//---------------------------------------------------------------------------
Expand Down Expand Up @@ -1794,6 +1766,4 @@ void ShbCirSignalHandlerReset(tShbInstance pShbInstance_p,

}

#endif

// EOF
17 changes: 0 additions & 17 deletions drivers/staging/epl/SharedBuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,6 @@ typedef void (*tShbCirSigHndlrReset) (tShbInstance pShbInstance_p,
extern "C" {
#endif

/*#if defined(INLINE_FUNCTION_DEF)
#undef INLINE_FUNCTION
#define INLINE_FUNCTION INLINE_FUNCTION_DEF
#define INLINE_ENABLED TRUE
#define SHAREDBUFF_INLINED
#include "SharedBuff.c"
#endif
*/

tShbError ShbInit(void);
tShbError ShbExit(void);

Expand All @@ -129,7 +120,6 @@ extern "C" {
unsigned int *pfShbNewCreated_p);
tShbError ShbCirReleaseBuffer(tShbInstance pShbInstance_p);

#if !defined(INLINE_ENABLED)

tShbError ShbCirResetBuffer(tShbInstance pShbInstance_p,
unsigned long ulTimeOut_p,
Expand Down Expand Up @@ -159,7 +149,6 @@ extern "C" {
pfnShbSignalHandlerNewData_p,
tShbPriority ShbPriority_p);

#endif

// Linear Shared Buffer
tShbError ShbLinAllocBuffer(unsigned long ulBufferSize_p,
Expand All @@ -168,7 +157,6 @@ extern "C" {
unsigned int *pfShbNewCreated_p);
tShbError ShbLinReleaseBuffer(tShbInstance pShbInstance_p);

#if !defined(INLINE_ENABLED)

tShbError ShbLinWriteDataBlock(tShbInstance pShbInstance_p,
unsigned long ulDstBufferOffs_p,
Expand All @@ -179,7 +167,6 @@ extern "C" {
unsigned long ulSrcBufferOffs_p,
unsigned long ulDataBlockSize_p);

#endif

#ifndef NDEBUG
tShbError ShbCirTraceBuffer(tShbInstance pShbInstance_p);
Expand All @@ -194,10 +181,6 @@ extern "C" {
#define ShbTraceDump(p0, p1, p2, p3)
#endif

#undef INLINE_ENABLED // disable actual inlining of functions
#undef INLINE_FUNCTION
#define INLINE_FUNCTION // define INLINE_FUNCTION to nothing

#ifdef __cplusplus
}
#endif
Expand Down
Loading

0 comments on commit 563b125

Please sign in to comment.