[PATCH 10/30] staging: unisys: change periodic_work.[ch] functions from bool to int

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

 



From: Erik Arfvidson <erik.arfvidson@xxxxxxxxxx>

This patch changes the following functions from bool to int:
visor_periodic_work_nextperiod
visor_periodic_work_destroy
visor_periodic_work_stop
visor_periodic_work_start
Also change struct periodic_work variables from bool to int

Signed-off-by: Erik Arfvidson <erik.arfvidson@xxxxxxxxxx>
Signed-off-by: Benjamin Romer <benjamin.romer@xxxxxxxxxx>
---
 drivers/staging/unisys/include/periodic_work.h   |  6 +--
 drivers/staging/unisys/visorutil/periodic_work.c | 52 ++++++++++++------------
 2 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/unisys/include/periodic_work.h b/drivers/staging/unisys/include/periodic_work.h
index 26ec10b..63008c6 100644
--- a/drivers/staging/unisys/include/periodic_work.h
+++ b/drivers/staging/unisys/include/periodic_work.h
@@ -31,8 +31,8 @@ struct periodic_work *visor_periodic_work_create(ulong jiffy_interval,
 					void *workfuncarg,
 					const char *devnam);
 void visor_periodic_work_destroy(struct periodic_work *pw);
-BOOL visor_periodic_work_nextperiod(struct periodic_work *pw);
-BOOL visor_periodic_work_start(struct periodic_work *pw);
-BOOL visor_periodic_work_stop(struct periodic_work *pw);
+int visor_periodic_work_nextperiod(struct periodic_work *pw);
+int visor_periodic_work_start(struct periodic_work *pw);
+int visor_periodic_work_stop(struct periodic_work *pw);
 
 #endif
diff --git a/drivers/staging/unisys/visorutil/periodic_work.c b/drivers/staging/unisys/visorutil/periodic_work.c
index 0908bf9..cde3b37 100644
--- a/drivers/staging/unisys/visorutil/periodic_work.c
+++ b/drivers/staging/unisys/visorutil/periodic_work.c
@@ -30,8 +30,8 @@ struct periodic_work {
 	struct delayed_work work;
 	void (*workfunc)(void *);
 	void *workfuncarg;
-	BOOL is_scheduled;
-	BOOL want_to_stop;
+	int is_scheduled;
+	int want_to_stop;
 	ulong jiffy_interval;
 	struct workqueue_struct *workqueue;
 	const char *devnam;
@@ -75,68 +75,68 @@ EXPORT_SYMBOL_GPL(visor_periodic_work_destroy);
 
 /** Call this from your periodic work worker function to schedule the next
  *  call.
- *  If this function returns FALSE, there was a failure and the
+ *  If this function returns 0, there was a failure and the
  *  periodic work is no longer scheduled
  */
-BOOL visor_periodic_work_nextperiod(struct periodic_work *pw)
+int visor_periodic_work_nextperiod(struct periodic_work *pw)
 {
-	BOOL rc = FALSE;
+	int rc = 0;
 
 	write_lock(&pw->lock);
 	if (pw->want_to_stop) {
-		pw->is_scheduled = FALSE;
-		pw->want_to_stop = FALSE;
-		rc = TRUE;  /* yes, TRUE; see visor_periodic_work_stop() */
+		pw->is_scheduled = 0;
+		pw->want_to_stop = 0;
+		rc = 1;  /* yes, TRUE; see visor_periodic_work_stop() */
 		goto unlock;
 	} else if (queue_delayed_work(pw->workqueue, &pw->work,
 				      pw->jiffy_interval) < 0) {
 		ERRDEV(pw->devnam, "queue_delayed_work failed!");
-		pw->is_scheduled = FALSE;
-		rc = FALSE;
+		pw->is_scheduled = 0;
+		rc = 0;
 		goto unlock;
 	}
-	rc = TRUE;
+	rc = 1;
 unlock:
 	write_unlock(&pw->lock);
 	return rc;
 }
 EXPORT_SYMBOL_GPL(visor_periodic_work_nextperiod);
 
-/** This function returns TRUE iff new periodic work was actually started.
- *  If this function returns FALSE, then no work was started
+/** This function returns 1 if new periodic work was actually started.
+ *  If this function returns 0, then no work was started
  *  (either because it was already started, or because of a failure).
  */
-BOOL visor_periodic_work_start(struct periodic_work *pw)
+int visor_periodic_work_start(struct periodic_work *pw)
 {
-	BOOL rc = FALSE;
+	int rc = 0;
 
 	write_lock(&pw->lock);
 	if (pw->is_scheduled) {
-		rc = FALSE;
+		rc = 0;
 		goto unlock;
 	}
 	if (pw->want_to_stop) {
 		ERRDEV(pw->devnam,
 		       "dev_start_periodic_work failed!");
-		rc = FALSE;
+		rc = 0;
 		goto unlock;
 	}
 	INIT_DELAYED_WORK(&pw->work, &periodic_work_func);
 	if (queue_delayed_work(pw->workqueue, &pw->work,
 			       pw->jiffy_interval) < 0) {
 		ERRDEV(pw->devnam, "%s queue_delayed_work failed!", __func__);
-		rc = FALSE;
+		rc = 0;
 		goto unlock;
 	}
-	pw->is_scheduled = TRUE;
-	rc = TRUE;
+	pw->is_scheduled = 1;
+	rc = 1;
 unlock:
 	write_unlock(&pw->lock);
 	return rc;
 }
 EXPORT_SYMBOL_GPL(visor_periodic_work_start);
 
-/** This function returns TRUE iff your call actually stopped the periodic
+/** This function returns 1 iff your call actually stopped the periodic
  *  work.
  *
  *  -- PAY ATTENTION... this is important --
@@ -170,20 +170,20 @@ EXPORT_SYMBOL_GPL(visor_periodic_work_start);
  *     this deadlock, you will get hung up in an infinite loop saying
  *     "waiting for delayed work...".
  */
-BOOL visor_periodic_work_stop(struct periodic_work *pw)
+int visor_periodic_work_stop(struct periodic_work *pw)
 {
-	BOOL stopped_something = FALSE;
+	int stopped_something = 0;
 
 	write_lock(&pw->lock);
 	stopped_something = pw->is_scheduled && (!pw->want_to_stop);
 	while (pw->is_scheduled) {
-		pw->want_to_stop = TRUE;
+		pw->want_to_stop = 1;
 		if (cancel_delayed_work(&pw->work)) {
 			/* We get here if the delayed work was pending as
 			 * delayed work, but was NOT run.
 			 */
 			ASSERT(pw->is_scheduled);
-			pw->is_scheduled = FALSE;
+			pw->is_scheduled = 0;
 		} else {
 			/* If we get here, either the delayed work:
 			 * - was run, OR,
@@ -208,7 +208,7 @@ BOOL visor_periodic_work_stop(struct periodic_work *pw)
 			SLEEPJIFFIES(10);
 			write_lock(&pw->lock);
 		} else {
-			pw->want_to_stop = FALSE;
+			pw->want_to_stop = 0;
 		}
 	}
 	write_unlock(&pw->lock);
-- 
2.1.0

_______________________________________________
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