Module Name:    src
Committed By:   skrll
Date:           Tue Jul 23 12:13:47 UTC 2019

Modified Files:
        src/sys/arch/evbarm/dev: plcom.c

Log Message:
Don't busy wait for a character in plcom_common_getc, but instead
return -1 if there are no characters available.

Fixes WSDISPLAY_MULTICONS for RaspberryPI and GENERIC.

Thanks to jmcneill@ for the hint


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/evbarm/dev/plcom.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/arch/evbarm/dev/plcom.c
diff -u src/sys/arch/evbarm/dev/plcom.c:1.57 src/sys/arch/evbarm/dev/plcom.c:1.58
--- src/sys/arch/evbarm/dev/plcom.c:1.57	Tue Jul 23 12:10:38 2019
+++ src/sys/arch/evbarm/dev/plcom.c	Tue Jul 23 12:13:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: plcom.c,v 1.57 2019/07/23 12:10:38 skrll Exp $	*/
+/*	$NetBSD: plcom.c,v 1.58 2019/07/23 12:13:47 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2001 ARM Ltd
@@ -94,7 +94,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.57 2019/07/23 12:10:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.58 2019/07/23 12:13:47 skrll Exp $");
 
 #include "opt_plcom.h"
 #include "opt_ddb.h"
@@ -2275,7 +2275,7 @@ int
 plcom_common_getc(dev_t dev, struct plcom_instance *pi)
 {
 	int s = splserial();
-	u_char stat, c;
+	u_char c;
 
 	/* got a character from reading things earlier */
 	if (plcom_readaheadcount > 0) {
@@ -2290,9 +2290,10 @@ plcom_common_getc(dev_t dev, struct plco
 		return c;
 	}
 
-	/* block until a character becomes available */
-	while (ISSET(stat = PREAD1(pi, PL01XCOM_FR), PL01X_FR_RXFE))
-		;
+	if (ISSET(PREAD1(pi, PL01XCOM_FR), PL01X_FR_RXFE)) {
+		splx(s);
+		return -1;
+	}
 
 	c = PREAD1(pi, PL01XCOM_DR);
 	{

Reply via email to