summaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
authorKen Cox <jkc@redhat.com>2014-03-19 13:06:19 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-03-19 13:55:40 -0700
commit9f8d0e8bac8c74706b698dedd8ce307395091508 (patch)
treea1f682ab2f165e094ab065fc840ade3bb067ad38 /drivers/staging
parent316d363d680131eb8aef89d1a3b5744f71a504f6 (diff)
Staging: unisys: Cleanup macros to get rid of goto statements
Remove the following macros: TRY CHKFD CHKDD CHKFDX CHKDDX ADDPROCLINE TRY_WPOSTCODE_1 TRY_WPOSTCODE_2 FAIL_WPOSTCODE_2 FAIL_WPOSTCODE_3 Part of a series to get rid of goto statements embedded in macros. I'm breaking this up into a series of smaller patches for easier review. The later patches in the series will actually remove the goto statements. Signed-off-by: Ken Cox <jkc@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/unisys/include/timskmod.h83
-rw-r--r--drivers/staging/unisys/visorchipset/visorchipset_main.c27
2 files changed, 18 insertions, 92 deletions
diff --git a/drivers/staging/unisys/include/timskmod.h b/drivers/staging/unisys/include/timskmod.h
index c4262ab2cac3..413a3673772d 100644
--- a/drivers/staging/unisys/include/timskmod.h
+++ b/drivers/staging/unisys/include/timskmod.h
@@ -155,44 +155,10 @@ typedef long VMMIO32;/**< #VMMIO pointing to 32-bit data */
POSTCODE_LINUX_2(EVENT_PC, DIAG_SEVERITY_ERR); \
RETINT(status); \
} while (0)
-#define FAIL_WPOSTCODE_2(msg, status, EVENT_PC, pcval32bit) do { \
- ERRDRV("'%s'" \
- ": error (status=%d)\n", \
- msg, status); \
- POSTCODE_LINUX_3(EVENT_PC, pcval32bit, DIAG_SEVERITY_ERR); \
- RETINT(status); \
- } while (0)
-#define FAIL_WPOSTCODE_3(msg, status, EVENT_PC, pcval16bit1, pcval16bit2) \
- do { \
- ERRDRV("'%s'" \
- ": error (status=%d)\n", \
- msg, status); \
- POSTCODE_LINUX_4(EVENT_PC, pcval16bit1, pcval16bit2, \
- DIAG_SEVERITY_ERR); \
- RETINT(status); \
- } while (0)
/** Try to evaulate the provided expression, and do a RETINT(x) iff
* the expression evaluates to < 0.
* @param x the expression to try
*/
-#define TRY(x) do { int status = (x); \
- if (status < 0) \
- FAIL(__stringify(x), status); \
- } while (0)
-
-#define TRY_WPOSTCODE_1(x, EVENT_PC) do { \
- int status = (x); \
- if (status < 0) \
- FAIL_WPOSTCODE_1(__stringify(x), status, EVENT_PC); \
- } while (0)
-
-#define TRY_WPOSTCODE_2(x, EVENT_PC, pcval32bit) do { \
- int status = (x); \
- if (status < 0) \
- FAIL_WPOSTCODE_2(__stringify(x), status, EVENT_PC, \
- pcval32bit); \
- } while (0)
-
#define ASSERT(cond) \
do { if (!(cond)) \
HUHDRV("ASSERT failed - %s", \
@@ -237,19 +203,6 @@ typedef long VMMIO32;/**< #VMMIO pointing to 32-bit data */
/* @} */
-/** Used to add a single line to the /proc filesystem buffer */
-#define ADDPROCLINE(buf, bufsize, line, linelen, totallen) \
- { \
- if ((totallen) + (linelen) >= bufsize) \
- RETINT(totallen); \
- if (linelen > 0) { \
- strcat(buf, line); \
- totallen += linelen; \
- } \
- }
-
-
-
/** Verifies the consistency of your PRIVATEDEVICEDATA structure using
* conventional "signature" fields:
* <p>
@@ -272,42 +225,6 @@ typedef long VMMIO32;/**< #VMMIO pointing to 32-bit data */
((fd)->sig1 == sizeof(PRIVATEFILEDATA)) && \
((fd)->sig2 == fd))
-/** Verifies the consistency of a PRIVATEDEVICEDATA structure and reacts
- * if necessary
- */
-#define CHKDDX(dd, x) ( \
- if (!DDLOOKSVALID((dd))) { \
- PRINTKDRV("bad device structure"); \
- RETINT(x); \
- })
-
-/** Verifies the consistency of a PRIVATEDEVICEDATA structure and reacts
- * if necessary
- */
-#define CHKDD(dd) ( \
- if (!DDLOOKSVALID(dd)) { \
- PRINTKDRV("bad device structure"); \
- RETVOID; \
- })
-
-/** Verifies the consistency of a PRIVATEFILEDATA structure and reacts
- * if necessary
- */
-#define CHKFDX(fd, x) ( \
- if (!FDLOOKSVALID(fd)) { \
- PRINTKDRV("bad file structure"); \
- RETINT(x); \
- })
-
-/** Verifies the consistency of a PRIVATEFILEDATA structure and reacts
- * if necessary
- */
-#define CHKFD(fd) ( \
- if (!FDLOOKSVALID(fd)) { \
- PRINTKDRV("bad file structure"); \
- RETVOID; \
- })
-
/** Locks dd->lockDev if you havn't already locked it */
#define LOCKDEV(dd) \
{ \
diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c
index e58b136d65e6..b0f97db2645e 100644
--- a/drivers/staging/unisys/visorchipset/visorchipset_main.c
+++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c
@@ -2684,14 +2684,21 @@ visorchipset_init(void)
memset(&LiveDump_info, 0, sizeof(LiveDump_info));
atomic_set(&LiveDump_info.buffers_in_use, 0);
- if (visorchipset_testvnic)
- FAIL_WPOSTCODE_2("testvnic option no longer supported", x,
- CHIPSET_INIT_FAILURE_PC, x);
+ if (visorchipset_testvnic) {
+ ERRDRV("testvnic option no longer supported: (status = %d)\n",
+ x);
+ POSTCODE_LINUX_3(CHIPSET_INIT_FAILURE_PC, x, DIAG_SEVERITY_ERR);
+ rc = x;
+ goto Away;
+ }
controlvm_init();
MajorDev = MKDEV(visorchipset_major, 0);
- TRY_WPOSTCODE_1(visorchipset_file_init(MajorDev, &ControlVm_channel),
- CHIPSET_INIT_FAILURE_PC);
+ rc = visorchipset_file_init(MajorDev, &ControlVm_channel);
+ if (rc < 0)
+ FAIL_WPOSTCODE_1("visorchipset_file_init(MajorDev, &ControlVm_channel)",
+ rc, CHIPSET_INIT_FAILURE_PC);
+
proc_Init();
memset(PartitionPropertyNames, 0, sizeof(PartitionPropertyNames));
memset(ControlVmPropertyNames, 0, sizeof(ControlVmPropertyNames));
@@ -2760,10 +2767,12 @@ visorchipset_init(void)
-ENOMEM, CREATE_WORKQUEUE_FAILED_PC);
Most_recent_message_jiffies = jiffies;
Poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST;
- TRY_WPOSTCODE_1(queue_delayed_work
- (Periodic_controlvm_workqueue,
- &Periodic_controlvm_work, Poll_jiffies),
- QUEUE_DELAYED_WORK_PC);
+ rc = queue_delayed_work(Periodic_controlvm_workqueue,
+ &Periodic_controlvm_work, Poll_jiffies);
+ if (rc < 0)
+ FAIL_WPOSTCODE_1("queue_delayed_work(Periodic_controlvm_workqueue, &Periodic_controlvm_work, Poll_jiffies);",
+ rc, QUEUE_DELAYED_WORK_PC);
+
}
Visorchipset_platform_device.dev.devt = MajorDev;