summaryrefslogtreecommitdiff
path: root/drivers/staging/epl/EplTimeruLinuxKernel.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2008-12-19 17:11:52 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2009-01-06 13:52:39 -0800
commit833dfbe746f85898dcbcf421c1177c3fd5773ff2 (patch)
treeeff8cbd5edeec1b7de31ac70459fe000a244df08 /drivers/staging/epl/EplTimeruLinuxKernel.c
parente0ca0595885e2e324eefe4f32cde6d65e61e6e28 (diff)
Staging: epl: run Lindent on *.c files
It's a start, still a mess... 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>
Diffstat (limited to 'drivers/staging/epl/EplTimeruLinuxKernel.c')
-rw-r--r--drivers/staging/epl/EplTimeruLinuxKernel.c302
1 files changed, 138 insertions, 164 deletions
diff --git a/drivers/staging/epl/EplTimeruLinuxKernel.c b/drivers/staging/epl/EplTimeruLinuxKernel.c
index 41dfb616d7d..08820d18405 100644
--- a/drivers/staging/epl/EplTimeruLinuxKernel.c
+++ b/drivers/staging/epl/EplTimeruLinuxKernel.c
@@ -86,10 +86,9 @@
//---------------------------------------------------------------------------
// local types
//---------------------------------------------------------------------------
-typedef struct
-{
- struct timer_list m_Timer;
- tEplTimerArg TimerArgument;
+typedef struct {
+ struct timer_list m_Timer;
+ tEplTimerArg TimerArgument;
} tEplTimeruData;
@@ -137,14 +136,13 @@ static void PUBLIC EplTimeruCbMs(unsigned long ulParameter_p);
tEplKernel PUBLIC EplTimeruInit()
{
-tEplKernel Ret;
+ tEplKernel Ret;
- Ret = EplTimeruAddInstance();
+ Ret = EplTimeruAddInstance();
- return Ret;
+ return Ret;
}
-
//---------------------------------------------------------------------------
//
// Function: EplTimeruAddInstance
@@ -161,14 +159,13 @@ tEplKernel Ret;
tEplKernel PUBLIC EplTimeruAddInstance()
{
-tEplKernel Ret;
+ tEplKernel Ret;
- Ret = kEplSuccessful;
+ Ret = kEplSuccessful;
- return Ret;
+ return Ret;
}
-
//---------------------------------------------------------------------------
//
// Function: EplTimeruDelInstance
@@ -187,14 +184,13 @@ tEplKernel Ret;
tEplKernel PUBLIC EplTimeruDelInstance()
{
-tEplKernel Ret;
+ tEplKernel Ret;
- Ret = kEplSuccessful;
+ Ret = kEplSuccessful;
- return Ret;
+ return Ret;
}
-
//---------------------------------------------------------------------------
//
// Function: EplTimeruSetTimerMs
@@ -211,43 +207,40 @@ tEplKernel Ret;
//
//---------------------------------------------------------------------------
-tEplKernel PUBLIC EplTimeruSetTimerMs(tEplTimerHdl* pTimerHdl_p,
- unsigned long ulTime_p,
- tEplTimerArg Argument_p)
+tEplKernel PUBLIC EplTimeruSetTimerMs(tEplTimerHdl * pTimerHdl_p,
+ unsigned long ulTime_p,
+ tEplTimerArg Argument_p)
{
-tEplKernel Ret = kEplSuccessful;
-tEplTimeruData* pData;
+ tEplKernel Ret = kEplSuccessful;
+ tEplTimeruData *pData;
- // check pointer to handle
- if(pTimerHdl_p == NULL)
- {
- Ret = kEplTimerInvalidHandle;
- goto Exit;
- }
+ // check pointer to handle
+ if (pTimerHdl_p == NULL) {
+ Ret = kEplTimerInvalidHandle;
+ goto Exit;
+ }
- pData = (tEplTimeruData*) EPL_MALLOC(sizeof (tEplTimeruData));
- if (pData == NULL)
- {
- Ret = kEplNoResource;
- goto Exit;
- }
+ pData = (tEplTimeruData *) EPL_MALLOC(sizeof(tEplTimeruData));
+ if (pData == NULL) {
+ Ret = kEplNoResource;
+ goto Exit;
+ }
- init_timer(&pData->m_Timer);
- pData->m_Timer.function = EplTimeruCbMs;
- pData->m_Timer.data = (unsigned long) pData;
- pData->m_Timer.expires = jiffies + ulTime_p * HZ / 1000;
+ init_timer(&pData->m_Timer);
+ pData->m_Timer.function = EplTimeruCbMs;
+ pData->m_Timer.data = (unsigned long)pData;
+ pData->m_Timer.expires = jiffies + ulTime_p * HZ / 1000;
- EPL_MEMCPY(&pData->TimerArgument, &Argument_p, sizeof(tEplTimerArg));
+ EPL_MEMCPY(&pData->TimerArgument, &Argument_p, sizeof(tEplTimerArg));
- add_timer(&pData->m_Timer);
+ add_timer(&pData->m_Timer);
- *pTimerHdl_p = (tEplTimerHdl) pData;
+ *pTimerHdl_p = (tEplTimerHdl) pData;
-Exit:
- return Ret;
+ Exit:
+ return Ret;
}
-
//---------------------------------------------------------------------------
//
// Function: EplTimeruModifyTimerMs
@@ -264,57 +257,50 @@ Exit:
//
//---------------------------------------------------------------------------
-tEplKernel PUBLIC EplTimeruModifyTimerMs(tEplTimerHdl* pTimerHdl_p,
- unsigned long ulTime_p,
- tEplTimerArg Argument_p)
+tEplKernel PUBLIC EplTimeruModifyTimerMs(tEplTimerHdl * pTimerHdl_p,
+ unsigned long ulTime_p,
+ tEplTimerArg Argument_p)
{
-tEplKernel Ret = kEplSuccessful;
-tEplTimeruData* pData;
-
- // check pointer to handle
- if(pTimerHdl_p == NULL)
- {
- Ret = kEplTimerInvalidHandle;
- goto Exit;
- }
-
- // check handle itself, i.e. was the handle initialized before
- if (*pTimerHdl_p == 0)
- {
- Ret = EplTimeruSetTimerMs(pTimerHdl_p, ulTime_p, Argument_p);
- goto Exit;
- }
- pData = (tEplTimeruData*) *pTimerHdl_p;
- if ((tEplTimeruData*)pData->m_Timer.data != pData)
- {
- Ret = kEplTimerInvalidHandle;
- goto Exit;
- }
-
- mod_timer(&pData->m_Timer, (jiffies + ulTime_p * HZ / 1000));
-
- // copy the TimerArg after the timer is restarted,
- // so that a timer occured immediately before mod_timer
- // won't use the new TimerArg and
- // therefore the old timer cannot be distinguished from the new one.
- // But if the new timer is too fast, it may get lost.
- EPL_MEMCPY(&pData->TimerArgument, &Argument_p, sizeof(tEplTimerArg));
-
- // check if timer is really running
- if (timer_pending(&pData->m_Timer) == 0)
- { // timer is not running
- // retry starting it
- add_timer(&pData->m_Timer);
- }
-
- // set handle to pointer of tEplTimeruData
+ tEplKernel Ret = kEplSuccessful;
+ tEplTimeruData *pData;
+
+ // check pointer to handle
+ if (pTimerHdl_p == NULL) {
+ Ret = kEplTimerInvalidHandle;
+ goto Exit;
+ }
+ // check handle itself, i.e. was the handle initialized before
+ if (*pTimerHdl_p == 0) {
+ Ret = EplTimeruSetTimerMs(pTimerHdl_p, ulTime_p, Argument_p);
+ goto Exit;
+ }
+ pData = (tEplTimeruData *) * pTimerHdl_p;
+ if ((tEplTimeruData *) pData->m_Timer.data != pData) {
+ Ret = kEplTimerInvalidHandle;
+ goto Exit;
+ }
+
+ mod_timer(&pData->m_Timer, (jiffies + ulTime_p * HZ / 1000));
+
+ // copy the TimerArg after the timer is restarted,
+ // so that a timer occured immediately before mod_timer
+ // won't use the new TimerArg and
+ // therefore the old timer cannot be distinguished from the new one.
+ // But if the new timer is too fast, it may get lost.
+ EPL_MEMCPY(&pData->TimerArgument, &Argument_p, sizeof(tEplTimerArg));
+
+ // check if timer is really running
+ if (timer_pending(&pData->m_Timer) == 0) { // timer is not running
+ // retry starting it
+ add_timer(&pData->m_Timer);
+ }
+ // set handle to pointer of tEplTimeruData
// *pTimerHdl_p = (tEplTimerHdl) pData;
-Exit:
- return Ret;
+ Exit:
+ return Ret;
}
-
//---------------------------------------------------------------------------
//
// Function: EplTimeruDeleteTimer
@@ -329,50 +315,45 @@ Exit:
//
//---------------------------------------------------------------------------
-tEplKernel PUBLIC EplTimeruDeleteTimer(tEplTimerHdl* pTimerHdl_p)
+tEplKernel PUBLIC EplTimeruDeleteTimer(tEplTimerHdl * pTimerHdl_p)
{
-tEplKernel Ret = kEplSuccessful;
-tEplTimeruData* pData;
-
- // check pointer to handle
- if(pTimerHdl_p == NULL)
- {
- Ret = kEplTimerInvalidHandle;
- goto Exit;
- }
-
- // check handle itself, i.e. was the handle initialized before
- if (*pTimerHdl_p == 0)
- {
- Ret = kEplSuccessful;
- goto Exit;
- }
- pData = (tEplTimeruData*) *pTimerHdl_p;
- if ((tEplTimeruData*)pData->m_Timer.data != pData)
- {
- Ret = kEplTimerInvalidHandle;
- goto Exit;
- }
+ tEplKernel Ret = kEplSuccessful;
+ tEplTimeruData *pData;
+
+ // check pointer to handle
+ if (pTimerHdl_p == NULL) {
+ Ret = kEplTimerInvalidHandle;
+ goto Exit;
+ }
+ // check handle itself, i.e. was the handle initialized before
+ if (*pTimerHdl_p == 0) {
+ Ret = kEplSuccessful;
+ goto Exit;
+ }
+ pData = (tEplTimeruData *) * pTimerHdl_p;
+ if ((tEplTimeruData *) pData->m_Timer.data != pData) {
+ Ret = kEplTimerInvalidHandle;
+ goto Exit;
+ }
/* if (del_timer(&pData->m_Timer) == 1)
{
kfree(pData);
}
*/
- // try to delete the timer
- del_timer(&pData->m_Timer);
- // free memory in any case
- kfree(pData);
+ // try to delete the timer
+ del_timer(&pData->m_Timer);
+ // free memory in any case
+ kfree(pData);
- // uninitialize handle
- *pTimerHdl_p = 0;
+ // uninitialize handle
+ *pTimerHdl_p = 0;
-Exit:
- return Ret;
+ Exit:
+ return Ret;
}
-
//---------------------------------------------------------------------------
//
// Function: EplTimeruIsTimerActive
@@ -391,33 +372,28 @@ Exit:
BOOL PUBLIC EplTimeruIsTimerActive(tEplTimerHdl TimerHdl_p)
{
-BOOL fActive = FALSE;
-tEplTimeruData* pData;
-
- // check handle itself, i.e. was the handle initialized before
- if (TimerHdl_p == 0)
- { // timer was not created yet, so it is not active
- goto Exit;
- }
- pData = (tEplTimeruData*) TimerHdl_p;
- if ((tEplTimeruData*)pData->m_Timer.data != pData)
- { // invalid timer
- goto Exit;
- }
-
- // check if timer is running
- if (timer_pending(&pData->m_Timer) == 0)
- { // timer is not running
- goto Exit;
- }
-
- fActive = TRUE;
-
-Exit:
- return fActive;
+ BOOL fActive = FALSE;
+ tEplTimeruData *pData;
+
+ // check handle itself, i.e. was the handle initialized before
+ if (TimerHdl_p == 0) { // timer was not created yet, so it is not active
+ goto Exit;
+ }
+ pData = (tEplTimeruData *) TimerHdl_p;
+ if ((tEplTimeruData *) pData->m_Timer.data != pData) { // invalid timer
+ goto Exit;
+ }
+ // check if timer is running
+ if (timer_pending(&pData->m_Timer) == 0) { // timer is not running
+ goto Exit;
+ }
+
+ fActive = TRUE;
+
+ Exit:
+ return fActive;
}
-
//=========================================================================//
// //
// P R I V A T E F U N C T I O N S //
@@ -443,30 +419,28 @@ Exit:
//---------------------------------------------------------------------------
static void PUBLIC EplTimeruCbMs(unsigned long ulParameter_p)
{
-tEplKernel Ret = kEplSuccessful;
-tEplTimeruData* pData;
-tEplEvent EplEvent;
-tEplTimerEventArg TimerEventArg;
+ tEplKernel Ret = kEplSuccessful;
+ tEplTimeruData *pData;
+ tEplEvent EplEvent;
+ tEplTimerEventArg TimerEventArg;
- pData = (tEplTimeruData*) ulParameter_p;
+ pData = (tEplTimeruData *) ulParameter_p;
- // call event function
- TimerEventArg.m_TimerHdl = (tEplTimerHdl)pData;
- TimerEventArg.m_ulArg = pData->TimerArgument.m_ulArg;
+ // call event function
+ TimerEventArg.m_TimerHdl = (tEplTimerHdl) pData;
+ TimerEventArg.m_ulArg = pData->TimerArgument.m_ulArg;
- EplEvent.m_EventSink = pData->TimerArgument.m_EventSink;
- EplEvent.m_EventType = kEplEventTypeTimer;
- EPL_MEMSET(&EplEvent.m_NetTime, 0x00, sizeof(tEplNetTime));
- EplEvent.m_pArg = &TimerEventArg;
- EplEvent.m_uiSize = sizeof(TimerEventArg);
+ EplEvent.m_EventSink = pData->TimerArgument.m_EventSink;
+ EplEvent.m_EventType = kEplEventTypeTimer;
+ EPL_MEMSET(&EplEvent.m_NetTime, 0x00, sizeof(tEplNetTime));
+ EplEvent.m_pArg = &TimerEventArg;
+ EplEvent.m_uiSize = sizeof(TimerEventArg);
- Ret = EplEventuPost(&EplEvent);
+ Ret = EplEventuPost(&EplEvent);
- // d.k. do not free memory, user has to call EplTimeruDeleteTimer()
- //kfree(pData);
+ // d.k. do not free memory, user has to call EplTimeruDeleteTimer()
+ //kfree(pData);
}
-
// EOF
-