From bb4911a74d70a7d5d11cfb04156766858d240ece Mon Sep 17 00:00:00 2001 From: John Ogness Date: Fri, 22 Sep 2023 14:31:09 +0000 Subject: [PATCH 151/204] tty: sysfs: Add nbcon support for 'active' Allow the 'active' attribute to list nbcon consoles. Signed-off-by: John Ogness Signed-off-by: Sebastian Andrzej Siewior --- drivers/tty/tty_io.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) Index: linux-6.6.58-rt45/drivers/tty/tty_io.c =================================================================== --- linux-6.6.58-rt45.orig/drivers/tty/tty_io.c +++ linux-6.6.58-rt45/drivers/tty/tty_io.c @@ -3543,8 +3543,15 @@ 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 && c->kthread)) { + continue; + } + } else { + if (!c->write) + continue; + } if ((c->flags & CON_ENABLED) == 0) continue; cs[i++] = c;