Subject: [PATCH 42/48] tty: sysfs: Add nbcon support for 'active'
From: John Ogness <[email-masked]>
Date: Fri, 22 Sep 2023 14:31:09 +0000

Allow the 'active' attribute to list nbcon consoles.

Signed-off-by: John Ogness <[email-masked]>
Signed-off-by: Sebastian Andrzej Siewior <[email-masked]>
---
 drivers/tty/tty_io.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Index: linux-6.8.2-rt10/drivers/tty/tty_io.c
===================================================================
--- linux-6.8.2-rt10.orig/drivers/tty/tty_io.c
+++ linux-6.8.2-rt10/drivers/tty/tty_io.c
@@ -3567,8 +3567,13 @@ static ssize_t show_cons_active(struct d
 	for_each_console(c) {
 		if (!c->device)
 			continue;
-		if (!c->write)
-			continue;
+		if (c->flags & CON_NBCON) {
+			if (!c->write_atomic && !c->write_thread)
+				continue;
+		} else {
+			if (!c->write)
+				continue;
+		}
 		if ((c->flags & CON_ENABLED) == 0)
 			continue;
 		cs[i++] = c;