Commit 3fe68ea0 authored by Luca Ellero's avatar Luca Ellero Committed by Greg Kroah-Hartman

staging: ced1401: fix ced_wait_event()

Rename camel case arguments and locals in function ced_wait_event()
Signed-off-by: default avatarLuca Ellero <luca.ellero@brickedbrain.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e1b3ca65
...@@ -863,45 +863,51 @@ int ced_set_event(struct ced_data *ced, struct transfer_event __user *ute) ...@@ -863,45 +863,51 @@ int ced_set_event(struct ced_data *ced, struct transfer_event __user *ute)
** of times that a block met the event condition since we last cleared it or ** of times that a block met the event condition since we last cleared it or
** 0 if timed out, or -ve error (bad area or not set, or signal). ** 0 if timed out, or -ve error (bad area or not set, or signal).
****************************************************************************/ ****************************************************************************/
int ced_wait_event(struct ced_data *ced, int nArea, int msTimeOut) int ced_wait_event(struct ced_data *ced, int area, int time_out)
{ {
int iReturn; int ret;
if ((unsigned)nArea >= MAX_TRANSAREAS) if ((unsigned)area >= MAX_TRANSAREAS)
return U14ERR_BADAREA; return U14ERR_BADAREA;
else { else {
int iWait; int wait;
struct transarea *pTA = &ced->trans_def[nArea]; struct transarea *ta = &ced->trans_def[area];
msTimeOut = (msTimeOut * HZ + 999) / 1000; /* convert timeout to jiffies */
/* We cannot wait holding the mutex, but we check the flags while holding */ /* convert timeout to jiffies */
/* it. This may well be pointless as another thread could get in between */ time_out = (time_out * HZ + 999) / 1000;
/* releasing it and the wait call. However, this would have to clear the */
/* iWakeUp flag. However, the !pTA-bUsed may help us in this case. */ /* We cannot wait holding the mutex, but we check the flags */
mutex_lock(&ced->io_mutex); /* make sure we have no competitor */ /* while holding it. This may well be pointless as another */
if (!pTA->used || !pTA->event_sz) /* check something to wait for... */ /* thread could get in between releasing it and the wait */
/* call. However, this would have to clear the wake_up flag. */
/* However, the !ta->used may help us in this case. */
/* make sure we have no competitor */
mutex_lock(&ced->io_mutex);
if (!ta->used || !ta->event_sz) /* check something to */
/* wait for... */
return U14ERR_NOTSET; /* ...else we do nothing */ return U14ERR_NOTSET; /* ...else we do nothing */
mutex_unlock(&ced->io_mutex); mutex_unlock(&ced->io_mutex);
if (msTimeOut) if (time_out)
iWait = wait = wait_event_interruptible_timeout(ta->event,
wait_event_interruptible_timeout(pTA->event, ta->wake_up ||
pTA->wake_up !ta->used,
|| !pTA->used, time_out);
msTimeOut);
else else
iWait = wait = wait_event_interruptible(ta->event,
wait_event_interruptible(pTA->event, pTA->wake_up ta->wake_up ||
|| !pTA->used); !ta->used);
if (iWait)
iReturn = -ERESTARTSYS; /* oops - we have had a SIGNAL */ if (wait)
ret = -ERESTARTSYS; /* oops - we have had a SIGNAL */
else else
iReturn = pTA->wake_up; /* else the wakeup count */ ret = ta->wake_up; /* else the wakeup count */
spin_lock_irq(&ced->staged_lock); spin_lock_irq(&ced->staged_lock);
pTA->wake_up = 0; /* clear the flag */ ta->wake_up = 0; /* clear the flag */
spin_unlock_irq(&ced->staged_lock); spin_unlock_irq(&ced->staged_lock);
} }
return iReturn; return ret;
} }
/**************************************************************************** /****************************************************************************
......
...@@ -253,6 +253,6 @@ extern int ced_dbg_stop_loop(struct ced_data *ced); ...@@ -253,6 +253,6 @@ extern int ced_dbg_stop_loop(struct ced_data *ced);
extern int ced_set_circular(struct ced_data *ced, struct transfer_area_desc __user *pTD); extern int ced_set_circular(struct ced_data *ced, struct transfer_area_desc __user *pTD);
extern int ced_get_circ_block(struct ced_data *ced, TCIRCBLOCK __user *pCB); extern int ced_get_circ_block(struct ced_data *ced, TCIRCBLOCK __user *pCB);
extern int ced_free_circ_block(struct ced_data *ced, TCIRCBLOCK __user *pCB); extern int ced_free_circ_block(struct ced_data *ced, TCIRCBLOCK __user *pCB);
extern int ced_wait_event(struct ced_data *ced, int nArea, int msTimeOut);
extern int ced_test_event(struct ced_data *ced, int nArea); extern int ced_test_event(struct ced_data *ced, int nArea);
extern int ced_wait_event(struct ced_data *ced, int area, int time_out);
#endif #endif
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