From: EunBong Song Date: Tue, 11 Apr 2017 23:32:52 +0000 (+0900) Subject: drivers/serial: simplify signaling method X-Git-Tag: 1.1_Public_Release~614^2~66 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4cfc08e6664439ed34e90680c0742c964c2098cf;p=rtos%2Ftinyara.git drivers/serial: simplify signaling method Commit ca9015e7 set xmitsem as a signaling semaphore. So we do not need to use sem_wait_for_isr and sem_post_from_isr for xmitsem. Change-Id: I4d895429f5f55014be463721bf642d513593d3ae Signed-off-by: EunBong Song --- diff --git a/os/drivers/serial/serial.c b/os/drivers/serial/serial.c index 7b2565c..9a18581 100644 --- a/os/drivers/serial/serial.c +++ b/os/drivers/serial/serial.c @@ -152,34 +152,6 @@ static int uart_takesem(FAR sem_t *sem, bool errout) return OK; } -/* - * This function attempts to lock the semaphore referenced by 'sem' - * which will be posted from interrupt handler. - * Because this function should have nothing to do with the priority - * inheritance, call sem_wait_for_isr() instead of sem_wait(). - */ -static int uart_takesem_wo_prio_inherit(FAR sem_t *sem, bool errout) -{ - /* Loop, ignoring interrupts, until we have successfully acquired the semaphore */ - - while (sem_wait_for_isr(sem) != OK) { - /* The only case that an error should occur here is if the wait was awakened - * by a signal. - */ - - ASSERT(get_errno() == EINTR); - - /* When the signal is received, should we errout? Or should we just continue - * waiting until we have the semaphore? - */ - - if (errout) { - return -EINTR; - } - } - - return OK; -} /************************************************************************************ * Name: uart_givesem @@ -288,7 +260,7 @@ static int uart_putxmitchar(FAR uart_dev_t *dev, int ch, bool oktoblock) dev->xmitwaiting = true; uart_enabletxint(dev); - ret = uart_takesem_wo_prio_inherit(&dev->xmitsem, true); + ret = uart_takesem(&dev->xmitsem, true); uart_disabletxint(dev); } @@ -1340,7 +1312,7 @@ void uart_datasent(FAR uart_dev_t *dev) /* Yes... wake it up */ dev->xmitwaiting = false; - (void)sem_post_from_isr(&dev->xmitsem); + (void)sem_post(&dev->xmitsem); } /* Notify all poll/select waiters that they can write to xmit buffer */