[PATCH 2/8] termios: Change tty_rcvwakeup to bool
Sebastian Huber
sebastian.huber at embedded-brains.de
Thu Feb 23 14:45:34 UTC 2017
Optimize callout invocation check.
---
cpukit/libcsupport/include/rtems/termiostypes.h | 2 +-
cpukit/libcsupport/src/termios.c | 18 +++++++++---------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/cpukit/libcsupport/include/rtems/termiostypes.h b/cpukit/libcsupport/include/rtems/termiostypes.h
index 2dcaa16..5240b85 100644
--- a/cpukit/libcsupport/include/rtems/termiostypes.h
+++ b/cpukit/libcsupport/include/rtems/termiostypes.h
@@ -377,7 +377,7 @@ typedef struct rtems_termios_tty {
*/
struct ttywakeup tty_snd;
struct ttywakeup tty_rcv;
- int tty_rcvwakeup;
+ bool tty_rcvwakeup;
/**
* @brief Corresponding device node.
diff --git a/cpukit/libcsupport/src/termios.c b/cpukit/libcsupport/src/termios.c
index f13e867..8445d23 100644
--- a/cpukit/libcsupport/src/termios.c
+++ b/cpukit/libcsupport/src/termios.c
@@ -440,7 +440,7 @@ rtems_termios_open_tty(
tty->tty_snd.sw_arg = NULL;
tty->tty_rcv.sw_pfn = NULL;
tty->tty_rcv.sw_arg = NULL;
- tty->tty_rcvwakeup = 0;
+ tty->tty_rcvwakeup = false;
tty->minor = minor;
tty->major = major;
@@ -1505,7 +1505,7 @@ rtems_termios_read_tty (struct rtems_termios_tty *tty, char *buffer,
*buffer++ = tty->cbuf[tty->cindex++];
count--;
}
- tty->tty_rcvwakeup = 0;
+ tty->tty_rcvwakeup = false;
return initial_count - count;
}
@@ -1522,7 +1522,7 @@ rtems_termios_read (void *arg)
if (rtems_termios_linesw[tty->t_line].l_read != NULL) {
sc = rtems_termios_linesw[tty->t_line].l_read(tty,args);
- tty->tty_rcvwakeup = 0;
+ tty->tty_rcvwakeup = false;
rtems_semaphore_release (tty->isem);
return sc;
}
@@ -1571,10 +1571,10 @@ rtems_termios_enqueue_raw_characters (void *ttyp, const char *buf, int len)
/*
* check to see if rcv wakeup callback was set
*/
- if (( !tty->tty_rcvwakeup ) && ( tty->tty_rcv.sw_pfn != NULL )) {
+ if (tty->tty_rcv.sw_pfn != NULL && !tty->tty_rcvwakeup) {
+ tty->tty_rcvwakeup = true;
(*tty->tty_rcv.sw_pfn)(&tty->termios, tty->tty_rcv.sw_arg);
- tty->tty_rcvwakeup = 1;
- }
+ }
return 0;
}
@@ -1659,9 +1659,9 @@ rtems_termios_enqueue_raw_characters (void *ttyp, const char *buf, int len)
/*
* check to see if rcv wakeup callback was set
*/
- if (( !tty->tty_rcvwakeup ) && ( tty->tty_rcv.sw_pfn != NULL )) {
+ if (tty->tty_rcv.sw_pfn != NULL && !tty->tty_rcvwakeup) {
+ tty->tty_rcvwakeup = true;
(*tty->tty_rcv.sw_pfn)(&tty->termios, tty->tty_rcv.sw_arg);
- tty->tty_rcvwakeup = 1;
}
}
}
@@ -1974,7 +1974,7 @@ rtems_termios_imfs_read (rtems_libio_t *iop, void *buffer, size_t count)
args.flags = iop->flags;
sc = rtems_termios_linesw[tty->t_line].l_read (tty, &args);
- tty->tty_rcvwakeup = 0;
+ tty->tty_rcvwakeup = false;
rtems_semaphore_release (tty->isem);
if (sc != RTEMS_SUCCESSFUL) {
--
1.8.4.5
More information about the devel
mailing list