[PATCH 4/8] Staging: unisys: Remove RETBOOL macro

Ken Cox jkc at redhat.com
Wed Mar 19 18:06:21 UTC 2014


The RETBOOL macro contained a goto statement which is not allowed in
the kernel.

Signed-off-by: Ken Cox <jkc at redhat.com>
---
 drivers/staging/unisys/include/timskmod.h          |  4 ---
 drivers/staging/unisys/uislib/uisqueue.c           |  1 -
 .../unisys/visorchannel/visorchannel_funcs.c       | 37 +++++++++++-----------
 drivers/staging/unisys/visorutil/periodic_work.c   | 22 ++++++++-----
 4 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/unisys/include/timskmod.h b/drivers/staging/unisys/include/timskmod.h
index 6abb32e..0623f55 100644
--- a/drivers/staging/unisys/include/timskmod.h
+++ b/drivers/staging/unisys/include/timskmod.h
@@ -132,10 +132,6 @@ typedef long VMMIO32;/**< #VMMIO pointing to 32-bit data */
  *  @param x the value to return
  */
 #define RETPTR(x)  do { rc = (x); RETTRACE(x); goto Away; } while (0)
-/** return from a BOOL function, using a common exit point "Away"
- *  @param x the value to return
- */
-#define RETBOOL(x) do { rc = (x); RETTRACE(x); goto Away; } while (0)
 /** Given a typedef/struct/union and a member field name,
  *  return the number of bytes occupied by that field.
  *  @param TYPE     the typedef name, or "struct xx" or "union xx"
diff --git a/drivers/staging/unisys/uislib/uisqueue.c b/drivers/staging/unisys/uislib/uisqueue.c
index a7a8b2e..7ea306e 100644
--- a/drivers/staging/unisys/uislib/uisqueue.c
+++ b/drivers/staging/unisys/uislib/uisqueue.c
@@ -31,7 +31,6 @@
 #define RETVOID    do { goto Away; } while (0)
 #define RETINT(x)  do { rc = (x); goto Away; } while (0)
 #define RETPTR(x)  do { rc = (x); goto Away; } while (0)
-#define RETBOOL(x) do { rc = (x); goto Away; } while (0)
 
 #define CHECK_CACHE_ALIGN 0
 
diff --git a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
index f397d83..ff4556b 100644
--- a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
+++ b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
@@ -313,7 +313,7 @@ sig_read_header(VISORCHANNEL *channel, U32 queue,
 		       queue, (int)SIG_QUEUE_OFFSET(&channel->chan_hdr, queue));
 		FAIL("visor_memregion_read of signal queue failed", FALSE);
 	}
-	RETBOOL(TRUE);
+	rc = TRUE;
 Away:
 	return rc;
 }
@@ -337,7 +337,7 @@ sig_do_data(VISORCHANNEL *channel, U32 queue,
 			FAIL("visor_memregion_read of signal data failed",
 			     FALSE);
 	}
-	RETBOOL(TRUE);
+	rc = TRUE;
 Away:
 	return rc;
 }
@@ -387,10 +387,14 @@ visorchannel_signalremove(VISORCHANNEL *channel, U32 queue, void *msg)
 	if (channel->needs_lock)
 		spin_lock(&channel->remove_lock);
 
-	if (!sig_read_header(channel, queue, &sig_hdr))
-		RETBOOL(FALSE);
-	if (sig_hdr.Head == sig_hdr.Tail)
-		RETBOOL(FALSE);	/* no signals to remove */
+	if (!sig_read_header(channel, queue, &sig_hdr)) {
+		rc = FALSE;
+		goto Away;
+	}
+	if (sig_hdr.Head == sig_hdr.Tail) {
+		rc = FALSE;	/* no signals to remove */
+		goto Away;
+	}
 	sig_hdr.Tail = (sig_hdr.Tail + 1) % sig_hdr.MaxSignalSlots;
 	if (!sig_read_data(channel, queue, &sig_hdr, sig_hdr.Tail, msg))
 		FAIL("sig_read_data failed", FALSE);
@@ -405,9 +409,7 @@ visorchannel_signalremove(VISORCHANNEL *channel, U32 queue, void *msg)
 	if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, NumSignalsReceived))
 		FAIL("visor_memregion_write of NumSignalsReceived failed",
 		     FALSE);
-
-	RETBOOL(TRUE);
-
+	rc = TRUE;
 Away:
 	if (channel->needs_lock)
 		spin_unlock(&channel->remove_lock);
@@ -425,20 +427,19 @@ visorchannel_signalinsert(VISORCHANNEL *channel, U32 queue, void *msg)
 	if (channel->needs_lock)
 		spin_lock(&channel->insert_lock);
 
-	if (!sig_read_header(channel, queue, &sig_hdr))
-		RETBOOL(FALSE);
+	if (!sig_read_header(channel, queue, &sig_hdr)) {
+		rc = FALSE;
+		goto Away;
+	}
 
 	sig_hdr.Head = ((sig_hdr.Head + 1) % sig_hdr.MaxSignalSlots);
 	if (sig_hdr.Head == sig_hdr.Tail) {
-#if 0
-		ERRDRV("visorchannel queue #%d overflow (max slots=%d)",
-		       queue, sig_hdr.MaxSignalSlots);
-#endif
 		sig_hdr.NumOverflows++;
 		if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, NumOverflows))
 			FAIL("visor_memregion_write of NumOverflows failed",
 			     FALSE);
-		RETBOOL(FALSE);
+		rc = FALSE;
+		goto Away;
 	}
 
 	if (!sig_write_data(channel, queue, &sig_hdr, sig_hdr.Head, msg))
@@ -453,9 +454,7 @@ visorchannel_signalinsert(VISORCHANNEL *channel, U32 queue, void *msg)
 		FAIL("visor_memregion_write of Head failed", FALSE);
 	if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, NumSignalsSent))
 		FAIL("visor_memregion_write of NumSignalsSent failed", FALSE);
-
-	RETBOOL(TRUE);
-
+	rc = TRUE;
 Away:
 	if (channel->needs_lock)
 		spin_unlock(&channel->insert_lock);
diff --git a/drivers/staging/unisys/visorutil/periodic_work.c b/drivers/staging/unisys/visorutil/periodic_work.c
index fb1e894..0670a31 100644
--- a/drivers/staging/unisys/visorutil/periodic_work.c
+++ b/drivers/staging/unisys/visorutil/periodic_work.c
@@ -96,15 +96,17 @@ BOOL visor_periodic_work_nextperiod(PERIODIC_WORK *periodic_work)
 	if (periodic_work->want_to_stop) {
 		periodic_work->is_scheduled = FALSE;
 		periodic_work->want_to_stop = FALSE;
-		RETBOOL(TRUE);  /* yes, TRUE; see visor_periodic_work_stop() */
+		rc = TRUE;  /* yes, TRUE; see visor_periodic_work_stop() */
+		goto Away;
 	} else if (queue_delayed_work(periodic_work->workqueue,
 				      &periodic_work->work,
 				      periodic_work->jiffy_interval) < 0) {
 		ERRDEV(periodic_work->devnam, "queue_delayed_work failed!");
 		periodic_work->is_scheduled = FALSE;
-		RETBOOL(FALSE);
+		rc = FALSE;
+		goto Away;
 	}
-	RETBOOL(TRUE);
+	rc = TRUE;
 Away:
 	write_unlock(&periodic_work->lock);
 	return rc;
@@ -122,12 +124,15 @@ BOOL visor_periodic_work_start(PERIODIC_WORK *periodic_work)
 	BOOL rc = FALSE;
 
 	write_lock(&periodic_work->lock);
-	if (periodic_work->is_scheduled)
-		RETBOOL(FALSE);
+	if (periodic_work->is_scheduled) {
+		rc = FALSE;
+		goto Away;
+	}
 	if (periodic_work->want_to_stop) {
 		ERRDEV(periodic_work->devnam,
 		       "dev_start_periodic_work failed!");
-		RETBOOL(FALSE);
+		rc = FALSE;
+		goto Away;
 	}
 	INIT_DELAYED_WORK(&periodic_work->work, &periodic_work_func);
 	if (queue_delayed_work(periodic_work->workqueue,
@@ -135,10 +140,11 @@ BOOL visor_periodic_work_start(PERIODIC_WORK *periodic_work)
 			       periodic_work->jiffy_interval) < 0) {
 		ERRDEV(periodic_work->devnam,
 		       "%s queue_delayed_work failed!", __func__);
-		RETBOOL(FALSE);
+		rc = FALSE;
+		goto Away;
 	}
 	periodic_work->is_scheduled = TRUE;
-	RETBOOL(TRUE);
+	rc = TRUE;
 Away:
 	write_unlock(&periodic_work->lock);
 	return rc;
-- 
1.8.5.3



More information about the devel mailing list