Fix wait loop and void cast (#24)

* Simplify EINTR/ECANCEL error handling

1. Add semaphore uninterruptible wait function
2 .Replace semaphore wait loop with a single uninterruptible wait
3. Replace all sem_xxx to nxsem_xxx

* Unify the void cast usage

1. Remove void cast for function because many place ignore the returned value witout cast
2. Replace void cast for variable with UNUSED macro
This commit is contained in:
Xiang Xiao
2020-01-02 10:49:34 -06:00
committed by Gregory Nutt
parent 316675f4db
commit 6a3c2aded6
1602 changed files with 6311 additions and 10874 deletions
+5 -5
View File
@@ -235,7 +235,7 @@ static void up_dumpstate(void)
#ifdef CONFIG_ARCH_USBDUMP
/* Dump USB trace data */
(void)usbtrace_enumerate(assert_tracecallback, NULL);
usbtrace_enumerate(assert_tracecallback, NULL);
#endif
}
#else
@@ -251,13 +251,13 @@ static void _up_assert(int errorcode)
{
/* Flush any buffered SYSLOG data */
(void)syslog_flush();
syslog_flush();
/* Are we in an interrupt handler or the idle task? */
if (g_current_regs || (running_task())->flink == NULL)
{
(void)up_irq_save();
up_irq_save();
for (;;)
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 1
@@ -298,7 +298,7 @@ void up_assert(const uint8_t *filename, int lineno)
/* Flush any buffered SYSLOG data (from prior to the assertion) */
(void)syslog_flush();
syslog_flush();
#if CONFIG_TASK_NAME_SIZE > 0
_alert("Assertion failed at file:%s line: %d task: %s\n",
@@ -312,7 +312,7 @@ void up_assert(const uint8_t *filename, int lineno)
/* Flush any buffered SYSLOG data (from the above) */
(void)syslog_flush();
syslog_flush();
#ifdef CONFIG_BOARD_CRASHDUMP
board_crashdump(up_getsp(), running_task(), filename, lineno);
+1 -1
View File
@@ -160,7 +160,7 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
* thread at the head of the ready-to-run list.
*/
(void)group_addrenv(rtcb);
group_addrenv(rtcb);
#endif
/* Reset scheduler parameters */
+3 -3
View File
@@ -147,7 +147,7 @@ void _exit(int status)
* The IRQ state will be restored when the next task is started.
*/
(void)enter_critical_section();
enter_critical_section();
sinfo("TCB=%p exiting\n", tcb);
@@ -162,7 +162,7 @@ void _exit(int status)
/* Destroy the task at the head of the ready to run list. */
(void)nxtask_exit();
nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the
* head of the list.
@@ -177,7 +177,7 @@ void _exit(int status)
* the ready-to-run list.
*/
(void)group_addrenv(tcb);
group_addrenv(tcb);
#endif
/* Reset scheduler parameters */
+4 -4
View File
@@ -183,7 +183,7 @@ void up_initialize(void)
#ifdef CONFIG_PSEUDOTERM_SUSV1
/* Register the master pseudo-terminal multiplexor device */
(void)ptmx_register();
ptmx_register();
#endif
/* Early initialization of the system logging device. Some SYSLOG channel
@@ -212,19 +212,19 @@ void up_initialize(void)
#ifdef CONFIG_NETDEV_LOOPBACK
/* Initialize the local loopback device */
(void)localhost_initialize();
localhost_initialize();
#endif
#ifdef CONFIG_NET_TUN
/* Initialize the TUN device */
(void)tun_initialize();
tun_initialize();
#endif
#ifdef CONFIG_NETDEV_TELNET
/* Initialize the Telnet session factory */
(void)telnet_initialize();
telnet_initialize();
#endif
/* Initialize USB -- device and/or host */
+1 -1
View File
@@ -130,7 +130,7 @@ void up_release_pending(void)
* thread at the head of the ready-to-run list.
*/
(void)group_addrenv(rtcb);
group_addrenv(rtcb);
#endif
/* Update scheduler parameters */
+1 -1
View File
@@ -183,7 +183,7 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
* thread at the head of the ready-to-run list.
*/
(void)group_addrenv(rtcb);
group_addrenv(rtcb);
#endif
/* Update scheduler parameters */
+1 -1
View File
@@ -144,7 +144,7 @@ void up_unblock_task(struct tcb_s *tcb)
* thread at the head of the ready-to-run list.
*/
(void)group_addrenv(rtcb);
group_addrenv(rtcb);
#endif
/* Update scheduler parameters */
+1 -1
View File
@@ -106,7 +106,7 @@ void up_sigdeliver(void)
*/
sinfo("Resuming\n");
(void)up_irq_save();
up_irq_save();
rtcb->pterrno = saved_errno;
/* Modify the saved return state with the actual saved values in the
+1 -1
View File
@@ -126,7 +126,7 @@ static uint32_t *common_handler(int irq, uint32_t *regs)
* thread at the head of the ready-to-run list.
*/
(void)group_addrenv(NULL);
group_addrenv(NULL);
#endif
}
#endif
+1 -1
View File
@@ -317,5 +317,5 @@ static ssize_t keypad_read(struct file *filep, FAR char *buf, size_t buflen)
void qemu_keypad(void)
{
(void)register_driver("/dev/keypad", &g_keypadops, 0444, NULL);
register_driver("/dev/keypad", &g_keypadops, 0444, NULL);
}
+1 -1
View File
@@ -123,7 +123,7 @@ void x86_timer_initialize(void)
/* Attach to the timer interrupt handler */
(void)irq_attach(IRQ0, (xcpt_t)qemu_timerisr, NULL);
irq_attach(IRQ0, (xcpt_t)qemu_timerisr, NULL);
/* Send the command byte to configure counter 0 */
+1 -1
View File
@@ -515,5 +515,5 @@ void qemu_vga(void)
}
memset(g_pscreen, g_bg_color, VGA_XRES * VGA_YRES);
(void)register_driver("/dev/lcd", &g_vgaops, 0666, NULL);
register_driver("/dev/lcd", &g_vgaops, 0666, NULL);
}