Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Now that cngetc supports -1 as a return value fro...



details:   https://anonhg.NetBSD.org/src/rev/bb4d94338f67
branches:  trunk
changeset: 325396:bb4d94338f67
user:      matt <matt%NetBSD.org@localhost>
date:      Sun Dec 22 18:20:46 2013 +0000

description:
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:

 sys/dev/ic/com.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (33 lines):

diff -r 7d61c0268016 -r bb4d94338f67 sys/dev/ic/com.c
--- a/sys/dev/ic/com.c  Sun Dec 22 18:05:40 2013 +0000
+++ b/sys/dev/ic/com.c  Sun Dec 22 18:20:46 2013 +0000
@@ -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 @@
                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);



Home | Main Index | Thread Index | Old Index