1818#include <linux/interrupt.h>
1919#include <linux/mm.h>
2020#include <linux/fs.h>
21- #include <linux/tty.h>
2221#include <linux/mount.h>
2322#include <linux/kdev_t.h>
2423#include <linux/major.h>
@@ -76,7 +75,7 @@ static int __init sysrq_always_enabled_setup(char *str)
7675__setup ("sysrq_always_enabled" , sysrq_always_enabled_setup );
7776
7877
79- static void sysrq_handle_loglevel (int key , struct tty_struct * tty )
78+ static void sysrq_handle_loglevel (int key )
8079{
8180 int i ;
8281
@@ -93,7 +92,7 @@ static struct sysrq_key_op sysrq_loglevel_op = {
9392};
9493
9594#ifdef CONFIG_VT
96- static void sysrq_handle_SAK (int key , struct tty_struct * tty )
95+ static void sysrq_handle_SAK (int key )
9796{
9897 struct work_struct * SAK_work = & vc_cons [fg_console ].SAK_work ;
9998 schedule_work (SAK_work );
@@ -109,7 +108,7 @@ static struct sysrq_key_op sysrq_SAK_op = {
109108#endif
110109
111110#ifdef CONFIG_VT
112- static void sysrq_handle_unraw (int key , struct tty_struct * tty )
111+ static void sysrq_handle_unraw (int key )
113112{
114113 struct kbd_struct * kbd = & kbd_table [fg_console ];
115114
@@ -126,7 +125,7 @@ static struct sysrq_key_op sysrq_unraw_op = {
126125#define sysrq_unraw_op (*(struct sysrq_key_op *)NULL)
127126#endif /* CONFIG_VT */
128127
129- static void sysrq_handle_crash (int key , struct tty_struct * tty )
128+ static void sysrq_handle_crash (int key )
130129{
131130 char * killer = NULL ;
132131
@@ -141,7 +140,7 @@ static struct sysrq_key_op sysrq_crash_op = {
141140 .enable_mask = SYSRQ_ENABLE_DUMP ,
142141};
143142
144- static void sysrq_handle_reboot (int key , struct tty_struct * tty )
143+ static void sysrq_handle_reboot (int key )
145144{
146145 lockdep_off ();
147146 local_irq_enable ();
@@ -154,7 +153,7 @@ static struct sysrq_key_op sysrq_reboot_op = {
154153 .enable_mask = SYSRQ_ENABLE_BOOT ,
155154};
156155
157- static void sysrq_handle_sync (int key , struct tty_struct * tty )
156+ static void sysrq_handle_sync (int key )
158157{
159158 emergency_sync ();
160159}
@@ -165,7 +164,7 @@ static struct sysrq_key_op sysrq_sync_op = {
165164 .enable_mask = SYSRQ_ENABLE_SYNC ,
166165};
167166
168- static void sysrq_handle_show_timers (int key , struct tty_struct * tty )
167+ static void sysrq_handle_show_timers (int key )
169168{
170169 sysrq_timer_list_show ();
171170}
@@ -176,7 +175,7 @@ static struct sysrq_key_op sysrq_show_timers_op = {
176175 .action_msg = "Show clockevent devices & pending hrtimers (no others)" ,
177176};
178177
179- static void sysrq_handle_mountro (int key , struct tty_struct * tty )
178+ static void sysrq_handle_mountro (int key )
180179{
181180 emergency_remount ();
182181}
@@ -188,7 +187,7 @@ static struct sysrq_key_op sysrq_mountro_op = {
188187};
189188
190189#ifdef CONFIG_LOCKDEP
191- static void sysrq_handle_showlocks (int key , struct tty_struct * tty )
190+ static void sysrq_handle_showlocks (int key )
192191{
193192 debug_show_all_locks ();
194193}
@@ -226,7 +225,7 @@ static void sysrq_showregs_othercpus(struct work_struct *dummy)
226225
227226static DECLARE_WORK (sysrq_showallcpus , sysrq_showregs_othercpus ) ;
228227
229- static void sysrq_handle_showallcpus (int key , struct tty_struct * tty )
228+ static void sysrq_handle_showallcpus (int key )
230229{
231230 /*
232231 * Fall back to the workqueue based printing if the
@@ -252,7 +251,7 @@ static struct sysrq_key_op sysrq_showallcpus_op = {
252251};
253252#endif
254253
255- static void sysrq_handle_showregs (int key , struct tty_struct * tty )
254+ static void sysrq_handle_showregs (int key )
256255{
257256 struct pt_regs * regs = get_irq_regs ();
258257 if (regs )
@@ -266,7 +265,7 @@ static struct sysrq_key_op sysrq_showregs_op = {
266265 .enable_mask = SYSRQ_ENABLE_DUMP ,
267266};
268267
269- static void sysrq_handle_showstate (int key , struct tty_struct * tty )
268+ static void sysrq_handle_showstate (int key )
270269{
271270 show_state ();
272271}
@@ -277,7 +276,7 @@ static struct sysrq_key_op sysrq_showstate_op = {
277276 .enable_mask = SYSRQ_ENABLE_DUMP ,
278277};
279278
280- static void sysrq_handle_showstate_blocked (int key , struct tty_struct * tty )
279+ static void sysrq_handle_showstate_blocked (int key )
281280{
282281 show_state_filter (TASK_UNINTERRUPTIBLE );
283282}
@@ -291,7 +290,7 @@ static struct sysrq_key_op sysrq_showstate_blocked_op = {
291290#ifdef CONFIG_TRACING
292291#include <linux/ftrace.h>
293292
294- static void sysrq_ftrace_dump (int key , struct tty_struct * tty )
293+ static void sysrq_ftrace_dump (int key )
295294{
296295 ftrace_dump (DUMP_ALL );
297296}
@@ -305,7 +304,7 @@ static struct sysrq_key_op sysrq_ftrace_dump_op = {
305304#define sysrq_ftrace_dump_op (*(struct sysrq_key_op *)NULL)
306305#endif
307306
308- static void sysrq_handle_showmem (int key , struct tty_struct * tty )
307+ static void sysrq_handle_showmem (int key )
309308{
310309 show_mem ();
311310}
@@ -330,7 +329,7 @@ static void send_sig_all(int sig)
330329 }
331330}
332331
333- static void sysrq_handle_term (int key , struct tty_struct * tty )
332+ static void sysrq_handle_term (int key )
334333{
335334 send_sig_all (SIGTERM );
336335 console_loglevel = 8 ;
@@ -349,7 +348,7 @@ static void moom_callback(struct work_struct *ignored)
349348
350349static DECLARE_WORK (moom_work , moom_callback ) ;
351350
352- static void sysrq_handle_moom (int key , struct tty_struct * tty )
351+ static void sysrq_handle_moom (int key )
353352{
354353 schedule_work (& moom_work );
355354}
@@ -361,7 +360,7 @@ static struct sysrq_key_op sysrq_moom_op = {
361360};
362361
363362#ifdef CONFIG_BLOCK
364- static void sysrq_handle_thaw (int key , struct tty_struct * tty )
363+ static void sysrq_handle_thaw (int key )
365364{
366365 emergency_thaw_all ();
367366}
@@ -373,7 +372,7 @@ static struct sysrq_key_op sysrq_thaw_op = {
373372};
374373#endif
375374
376- static void sysrq_handle_kill (int key , struct tty_struct * tty )
375+ static void sysrq_handle_kill (int key )
377376{
378377 send_sig_all (SIGKILL );
379378 console_loglevel = 8 ;
@@ -385,7 +384,7 @@ static struct sysrq_key_op sysrq_kill_op = {
385384 .enable_mask = SYSRQ_ENABLE_SIGNAL ,
386385};
387386
388- static void sysrq_handle_unrt (int key , struct tty_struct * tty )
387+ static void sysrq_handle_unrt (int key )
389388{
390389 normalize_rt_tasks ();
391390}
@@ -493,7 +492,7 @@ static void __sysrq_put_key_op(int key, struct sysrq_key_op *op_p)
493492 sysrq_key_table [i ] = op_p ;
494493}
495494
496- void __handle_sysrq (int key , struct tty_struct * tty , int check_mask )
495+ void __handle_sysrq (int key , bool check_mask )
497496{
498497 struct sysrq_key_op * op_p ;
499498 int orig_log_level ;
@@ -520,7 +519,7 @@ void __handle_sysrq(int key, struct tty_struct *tty, int check_mask)
520519 if (!check_mask || sysrq_on_mask (op_p -> enable_mask )) {
521520 printk ("%s\n" , op_p -> action_msg );
522521 console_loglevel = orig_log_level ;
523- op_p -> handler (key , tty );
522+ op_p -> handler (key );
524523 } else {
525524 printk ("This sysrq operation is disabled.\n" );
526525 }
@@ -545,10 +544,10 @@ void __handle_sysrq(int key, struct tty_struct *tty, int check_mask)
545544 spin_unlock_irqrestore (& sysrq_key_table_lock , flags );
546545}
547546
548- void handle_sysrq (int key , struct tty_struct * tty )
547+ void handle_sysrq (int key )
549548{
550549 if (sysrq_on ())
551- __handle_sysrq (key , tty , 1 );
550+ __handle_sysrq (key , true );
552551}
553552EXPORT_SYMBOL (handle_sysrq );
554553
@@ -597,7 +596,7 @@ static bool sysrq_filter(struct input_handle *handle, unsigned int type,
597596
598597 default :
599598 if (sysrq_down && value && value != 2 )
600- __handle_sysrq (sysrq_xlate [code ], NULL , 1 );
599+ __handle_sysrq (sysrq_xlate [code ], true );
601600 break ;
602601 }
603602
@@ -765,7 +764,7 @@ static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf,
765764
766765 if (get_user (c , buf ))
767766 return - EFAULT ;
768- __handle_sysrq (c , NULL , 0 );
767+ __handle_sysrq (c , false );
769768 }
770769
771770 return count ;
0 commit comments