[PATCH 2/2] Add disabled text to indicate inactive commands in sysrq help menu

From: Andras Sebok
Date: Mon Aug 28 2023 - 06:31:47 EST


This patch adds disabled text after disabled commands in sysrq help.

before:
sak : k

after:
sak : k (disabled)

Signed-off-by: Andras Sebok <sebokandris2009@xxxxxxxxx>
---
drivers/tty/sysrq.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index 831cdadf366f..1af78f76232e 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -617,6 +617,9 @@ void __handle_sysrq(int key, bool check_mask)
if (j != i)
continue;
pr_cont("%s ", sysrq_key_table[i]->help_msg);
+ if (!check_mask || (check_mask &&
+ !sysrq_on_mask(sysrq_key_table[i]->enable_mask)))
+ pr_cont("(disabled)");
pr_cont("\n");
}
}
--
2.41.0