summaryrefslogtreecommitdiffstats
path: root/sys/dev/uart/uart_dev_sab82532.c
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2007-01-18 22:01:19 +0000
committermarius <marius@FreeBSD.org>2007-01-18 22:01:19 +0000
commit545a381d5f5917c12078fc06b779fab7711c053e (patch)
tree9d40efb79e6c86a1071e9763b706b391d9e9c487 /sys/dev/uart/uart_dev_sab82532.c
parent6f6da4e54a1b02d5dd2237063607a3b22d39e819 (diff)
downloadFreeBSD-src-545a381d5f5917c12078fc06b779fab7711c053e.zip
FreeBSD-src-545a381d5f5917c12078fc06b779fab7711c053e.tar.gz
- Add a uart_rxready() and corresponding device-specific implementations
that can be used to check whether receive data is ready, i.e. whether the subsequent call of uart_poll() should return a char, and unlike uart_poll() doesn't actually receive data. - Remove the device-specific implementations of uart_poll() and implement uart_poll() in terms of uart_getc() and the newly added uart_rxready() in order to minimize code duplication. - In sunkbd(4) take advantage of uart_rxready() and use it to implement the polled mode part of sunkbd_check() so we don't need to buffer a potentially read char in the softc. - Fix some mis-indentation in sunkbd_read_char(). Discussed with: marcel
Diffstat (limited to 'sys/dev/uart/uart_dev_sab82532.c')
-rw-r--r--sys/dev/uart/uart_dev_sab82532.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/dev/uart/uart_dev_sab82532.c b/sys/dev/uart/uart_dev_sab82532.c
index 9ef0bd1..e10ae17 100644
--- a/sys/dev/uart/uart_dev_sab82532.c
+++ b/sys/dev/uart/uart_dev_sab82532.c
@@ -173,7 +173,7 @@ static int sab82532_probe(struct uart_bas *bas);
static void sab82532_init(struct uart_bas *bas, int, int, int, int);
static void sab82532_term(struct uart_bas *bas);
static void sab82532_putc(struct uart_bas *bas, int);
-static int sab82532_poll(struct uart_bas *bas);
+static int sab82532_rxready(struct uart_bas *bas);
static int sab82532_getc(struct uart_bas *bas, struct mtx *);
struct uart_ops uart_sab82532_ops = {
@@ -181,7 +181,7 @@ struct uart_ops uart_sab82532_ops = {
.init = sab82532_init,
.term = sab82532_term,
.putc = sab82532_putc,
- .poll = sab82532_poll,
+ .rxready = sab82532_rxready,
.getc = sab82532_getc,
};
@@ -303,12 +303,10 @@ sab82532_putc(struct uart_bas *bas, int c)
}
static int
-sab82532_poll(struct uart_bas *bas)
+sab82532_rxready(struct uart_bas *bas)
{
- if (uart_getreg(bas, SAB_STAR) & SAB_STAR_RFNE)
- return (sab82532_getc(bas, NULL));
- return (-1);
+ return ((uart_getreg(bas, SAB_STAR) & SAB_STAR_RFNE) != 0 ? 1 : 0);
}
static int
OpenPOWER on IntegriCloud