[PATCH 094/115] staging: ced1401: fix ced_wait_event()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rename camel case arguments and locals in function ced_wait_event()

Signed-off-by: Luca Ellero <luca.ellero@xxxxxxxxxxxxxxxx>
---
 drivers/staging/ced1401/ced_ioc.c |   50 +++++++++++++++++++++----------------
 drivers/staging/ced1401/usb1401.h |    2 +-
 2 files changed, 29 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c b/drivers/staging/ced1401/ced_ioc.c
index 751dadb..8d6b9f1 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -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
 ** 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;
-	if ((unsigned)nArea >= MAX_TRANSAREAS)
+	int ret;
+	if ((unsigned)area >= MAX_TRANSAREAS)
 		return U14ERR_BADAREA;
 	else {
 		int iWait;
-		struct transarea *pTA = &ced->trans_def[nArea];
-		msTimeOut = (msTimeOut * HZ + 999) / 1000;	/*  convert timeout to jiffies */
+		struct transarea *ta = &ced->trans_def[area];
 
-		/*  We cannot wait holding the mutex, but we check the flags while holding */
-		/*  it. This may well be pointless as another thread could get in between */
-		/*  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. */
-		mutex_lock(&ced->io_mutex);	/*  make sure we have no competitor */
-		if (!pTA->used || !pTA->event_sz)	/*  check something to wait for... */
+		 /* convert timeout to jiffies */
+		time_out = (time_out * HZ + 999) / 1000;
+
+		/* We cannot wait holding the mutex, but we check the flags  */
+		/* while holding it. This may well be pointless as another   */
+		/* 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 */
 		mutex_unlock(&ced->io_mutex);
 
-		if (msTimeOut)
+		if (time_out)
 			iWait =
-			    wait_event_interruptible_timeout(pTA->event,
-							     pTA->wake_up
-							     || !pTA->used,
-							     msTimeOut);
+			    wait_event_interruptible_timeout(ta->event,
+							     ta->wake_up
+							     || !ta->used,
+							     time_out);
 		else
 			iWait =
-			    wait_event_interruptible(pTA->event, pTA->wake_up
-						     || !pTA->used);
+			    wait_event_interruptible(ta->event, ta->wake_up
+						     || !ta->used);
 		if (iWait)
-			iReturn = -ERESTARTSYS;	/*  oops - we have had a SIGNAL */
+			ret = -ERESTARTSYS; /* oops - we have had a SIGNAL */
 		else
-			iReturn = pTA->wake_up;	/*  else the wakeup count */
+			ret = ta->wake_up; /* else the wakeup count */
 
 		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);
 	}
-	return iReturn;
+	return ret;
 }
 
 /****************************************************************************
diff --git a/drivers/staging/ced1401/usb1401.h b/drivers/staging/ced1401/usb1401.h
index 6ae2e86..71263f7 100644
--- a/drivers/staging/ced1401/usb1401.h
+++ b/drivers/staging/ced1401/usb1401.h
@@ -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_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_wait_event(struct ced_data *ced, int nArea, int msTimeOut);
+extern int ced_wait_event(struct ced_data *ced, int area, int time_out);
 extern int ced_test_event(struct ced_data *ced, int nArea);
 #endif
-- 
1.7.10.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux