* @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"
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;
}
FAIL("visor_memregion_read of signal data failed",
FALSE);
}
- RETBOOL(TRUE);
+ rc = TRUE;
Away:
return rc;
}
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);
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);
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))
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);
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;
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,
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;