diff options
| author | matt <matt@NetBSD.org> | 2013-12-22 18:20:46 +0000 |
|---|---|---|
| committer | matt <matt@NetBSD.org> | 2013-12-22 18:20:46 +0000 |
| commit | d9a30cdd5fdff00d4f9be99b858474852ad84354 (patch) | |
| tree | 4529c711ca87de17b6b18f7d0437b84652a8616e /sys/dev | |
| parent | c792a6a2dc6020a600cabdda4682577baf282d38 (diff) | |
Now that cngetc supports -1 as a return value from the cn_getc routine,
let cngetc loop until a character is available so it can call the critpoll
hooks.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/ic/com.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c index 8531949d394..4cda2a4ed1a 100644 --- a/sys/dev/ic/com.c +++ b/sys/dev/ic/com.c @@ -1,4 +1,4 @@ -/* $NetBSD: com.c,v 1.321 2013/12/16 12:08:14 skrll Exp $ */ +/* $NetBSD: com.c,v 1.322 2013/12/22 18:20:46 matt Exp $ */ /*- * Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.321 2013/12/16 12:08:14 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.322 2013/12/22 18:20:46 matt Exp $"); #include "opt_com.h" #include "opt_ddb.h" @@ -2217,9 +2217,11 @@ com_common_getc(dev_t dev, struct com_regs *regsp) return (c); } - /* block until a character becomes available */ - while (!ISSET(stat = CSR_READ_1(regsp, COM_REG_LSR), LSR_RXRDY)) - ; + /* don't block until a character becomes available */ + if (!ISSET(stat = CSR_READ_1(regsp, COM_REG_LSR), LSR_RXRDY)) { + splx(s); + return -1; + } c = CSR_READ_1(regsp, COM_REG_RXDATA); stat = CSR_READ_1(regsp, COM_REG_IIR); |
