Module Name:    src
Committed By:   matt
Date:           Sun Dec 22 18:20:46 UTC 2013

Modified Files:
        src/sys/dev/ic: com.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.321 -r1.322 src/sys/dev/ic/com.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/com.c
diff -u src/sys/dev/ic/com.c:1.321 src/sys/dev/ic/com.c:1.322
--- src/sys/dev/ic/com.c:1.321	Mon Dec 16 12:08:14 2013
+++ src/sys/dev/ic/com.c	Sun Dec 22 18:20:46 2013
@@ -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_re
 		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);

Reply via email to