diff mbox series

tty/sysrq: make sysrq_replay_logs_op const and refactor sysrq_mask()

Message ID tencent_F413E4391B578208516E16AA0FC81F2FEC07@qq.com
State New
Headers show
Series tty/sysrq: make sysrq_replay_logs_op const and refactor sysrq_mask() | expand

Commit Message

xiaopeitux@foxmail.com April 3, 2025, 7:15 a.m. UTC
From: Pei Xiao <xiaopei01@kylinos.cn>

Mark sysrq_replay_logs_op as const and simplify sysrq_mask().

Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
---
 drivers/tty/sysrq.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index f85ce02e4725..c2a26abcb8cd 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -71,9 +71,7 @@  static bool sysrq_on(void)
  */
 int sysrq_mask(void)
 {
-	if (sysrq_always_enabled)
-		return 1;
-	return sysrq_enabled;
+	return sysrq_always_enabled ? 1 : sysrq_enabled;
 }
 EXPORT_SYMBOL_GPL(sysrq_mask);
 
@@ -454,7 +452,7 @@  static void sysrq_handle_replay_logs(u8 key)
 {
 	console_try_replay_all();
 }
-static struct sysrq_key_op sysrq_replay_logs_op = {
+static const struct sysrq_key_op sysrq_replay_logs_op = {
 	.handler        = sysrq_handle_replay_logs,
 	.help_msg       = "replay-kernel-logs(R)",
 	.action_msg     = "Replay kernel logs on consoles",