[rtems-libbsd commit] termios: Update due to API changes

Sebastian Huber sebh at rtems.org
Mon Feb 5 10:39:38 UTC 2018


Module:    rtems-libbsd
Branch:    master
Commit:    8b3da1329bc95d559ba1d7b562cbf93f9ca92156
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=8b3da1329bc95d559ba1d7b562cbf93f9ca92156

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Jan  8 13:55:36 2018 +0100

termios: Update due to API changes

Update #2843.

---

 rtemsbsd/rtems/rtems-kernel-termioskqueuepoll.c | 31 +++++++------------------
 1 file changed, 8 insertions(+), 23 deletions(-)

diff --git a/rtemsbsd/rtems/rtems-kernel-termioskqueuepoll.c b/rtemsbsd/rtems/rtems-kernel-termioskqueuepoll.c
index 0ac2ab7..a3b2c60 100644
--- a/rtemsbsd/rtems/rtems-kernel-termioskqueuepoll.c
+++ b/rtemsbsd/rtems/rtems-kernel-termioskqueuepoll.c
@@ -154,18 +154,13 @@ termios_receive_wakeup(void *arg)
 {
 	termios_selinfo *ts;
 	rtems_termios_tty *tty;
-	rtems_status_code sc;
 
 	ts = arg;
 	tty = ts->tty;
 
-	sc = rtems_semaphore_obtain(tty->isem, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
-	BSD_ASSERT(sc == RTEMS_SUCCESSFUL);
-
+	rtems_mutex_lock(&tty->isem);
 	selwakeup(&ts->sel);
-
-	sc = rtems_semaphore_release(tty->isem);
-	BSD_ASSERT(sc == RTEMS_SUCCESSFUL);
+	rtems_mutex_unlock(&tty->isem);
 }
 
 static void
@@ -173,18 +168,13 @@ termios_transmit_wakeup(void *arg)
 {
 	termios_selinfo *ts;
 	rtems_termios_tty *tty;
-	rtems_status_code sc;
 
 	ts = arg;
 	tty = ts->tty;
 
-	sc = rtems_semaphore_obtain(tty->osem, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
-	BSD_ASSERT(sc == RTEMS_SUCCESSFUL);
-
+	rtems_mutex_lock(&tty->osem);
 	selwakeup(&ts->sel);
-
-	sc = rtems_semaphore_release(tty->osem);
-	BSD_ASSERT(sc == RTEMS_SUCCESSFUL);
+	rtems_mutex_unlock(&tty->osem);
 }
 
 static void
@@ -229,7 +219,6 @@ rtems_termios_poll(rtems_libio_t *iop, int events)
 	struct thread *td = rtems_bsd_get_curthread_or_wait_forever();
 	struct selinfo *sel;
 	rtems_termios_tty *tty;
-	rtems_status_code sc;
 	int revents;
 
 	revents = 0;
@@ -239,8 +228,7 @@ rtems_termios_poll(rtems_libio_t *iop, int events)
 		sel = termios_get_selinfo(tty, &tty->tty_rcv,
 		    termios_receive_wakeup);
 
-		sc = rtems_semaphore_obtain(tty->isem, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
-		BSD_ASSERT(sc == RTEMS_SUCCESSFUL);
+		rtems_mutex_lock(&tty->isem);
 
 		if (termios_can_read(tty)) {
 			revents |= events & (POLLIN | POLLRDNORM);
@@ -248,16 +236,14 @@ rtems_termios_poll(rtems_libio_t *iop, int events)
 			selrecord(td, sel);
 		}
 
-		sc = rtems_semaphore_release(tty->isem);
-		BSD_ASSERT(sc == RTEMS_SUCCESSFUL);
+		rtems_mutex_unlock(&tty->isem);
 	}
 
 	if ((events & (POLLOUT | POLLWRNORM)) != 0) {
 		sel = termios_get_selinfo(tty, &tty->tty_snd,
 		    termios_transmit_wakeup);
 
-		sc = rtems_semaphore_obtain(tty->osem, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
-		BSD_ASSERT(sc == RTEMS_SUCCESSFUL);
+		rtems_mutex_lock(&tty->osem);
 
 		if (termios_can_write(tty)) {
 			revents |= events & (POLLOUT | POLLWRNORM);
@@ -265,8 +251,7 @@ rtems_termios_poll(rtems_libio_t *iop, int events)
 			selrecord(td, sel);
 		}
 
-		sc = rtems_semaphore_release(tty->osem);
-		BSD_ASSERT(sc == RTEMS_SUCCESSFUL);
+		rtems_mutex_unlock(&tty->osem);
 	}
 
 	return (revents);




More information about the vc mailing list