Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tty: sysrq: switch sysrq handlers from int to u8

The passed parameter to sysrq handlers is a key (a character). So change
the type from 'int' to 'u8'. Let it specifically be 'u8' for two
reasons:
* unsigned: unsigned values come from the upper layers (devices) and the
tty layer assumes unsigned on most places, and
* 8-bit: as that what's supposed to be one day in all the layers built
on the top of tty. (Currently, we use mostly 'unsigned char' and
somewhere still only 'char'. (But that also translates to the former
thanks to -funsigned-char.))

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: WANG Xuerui <kernel@xen0n.name>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Len Brown <len.brown@intel.com>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Frederic Weisbecker <frederic@kernel.org>
Cc: Neeraj Upadhyay <quic_neeraju@quicinc.com>
Cc: Joel Fernandes <joel@joelfernandes.org>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: Zqiang <qiang.zhang1211@gmail.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de> # DRM
Acked-by: WANG Xuerui <git@xen0n.name> # loongarch
Acked-by: Paul E. McKenney <paulmck@kernel.org>
Acked-by: Daniel Thompson <daniel.thompson@linaro.org>
Link: https://lore.kernel.org/r/20230712081811.29004-3-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jiri Slaby and committed by
Greg Kroah-Hartman
bcb48185 00ef7eff

+31 -31
+1 -1
arch/alpha/kernel/setup.c
··· 422 422 arch_initcall(register_cpus); 423 423 424 424 #ifdef CONFIG_MAGIC_SYSRQ 425 - static void sysrq_reboot_handler(int unused) 425 + static void sysrq_reboot_handler(u8 unused) 426 426 { 427 427 machine_halt(); 428 428 }
+1 -1
arch/loongarch/kernel/sysrq.c
··· 43 43 static DECLARE_WORK(sysrq_tlbdump, sysrq_tlbdump_othercpus); 44 44 #endif 45 45 46 - static void sysrq_handle_tlbdump(int key) 46 + static void sysrq_handle_tlbdump(u8 key) 47 47 { 48 48 sysrq_tlbdump_single(NULL); 49 49 #ifdef CONFIG_SMP
+1 -1
arch/mips/kernel/sysrq.c
··· 44 44 static DECLARE_WORK(sysrq_tlbdump, sysrq_tlbdump_othercpus); 45 45 #endif 46 46 47 - static void sysrq_handle_tlbdump(int key) 47 + static void sysrq_handle_tlbdump(u8 key) 48 48 { 49 49 sysrq_tlbdump_single(NULL); 50 50 #ifdef CONFIG_SMP
+1 -1
arch/powerpc/xmon/xmon.c
··· 3991 3991 } 3992 3992 3993 3993 #ifdef CONFIG_MAGIC_SYSRQ 3994 - static void sysrq_handle_xmon(int key) 3994 + static void sysrq_handle_xmon(u8 key) 3995 3995 { 3996 3996 if (xmon_is_locked_down()) { 3997 3997 clear_all_bpt();
+2 -2
arch/sparc/kernel/process_64.c
··· 295 295 296 296 #ifdef CONFIG_MAGIC_SYSRQ 297 297 298 - static void sysrq_handle_globreg(int key) 298 + static void sysrq_handle_globreg(u8 key) 299 299 { 300 300 trigger_all_cpu_backtrace(); 301 301 } ··· 370 370 spin_unlock_irqrestore(&global_cpu_snapshot_lock, flags); 371 371 } 372 372 373 - static void sysrq_handle_globpmu(int key) 373 + static void sysrq_handle_globpmu(u8 key) 374 374 { 375 375 pmu_snapshot_all_cpus(); 376 376 }
+1 -1
drivers/gpu/drm/drm_fb_helper.c
··· 301 301 302 302 static DECLARE_WORK(drm_fb_helper_restore_work, drm_fb_helper_restore_work_fn); 303 303 304 - static void drm_fb_helper_sysrq(int dummy1) 304 + static void drm_fb_helper_sysrq(u8 dummy1) 305 305 { 306 306 schedule_work(&drm_fb_helper_restore_work); 307 307 }
+20 -20
drivers/tty/sysrq.c
··· 98 98 __setup("sysrq_always_enabled", sysrq_always_enabled_setup); 99 99 100 100 101 - static void sysrq_handle_loglevel(int key) 101 + static void sysrq_handle_loglevel(u8 key) 102 102 { 103 103 u8 loglevel = key - '0'; 104 104 ··· 114 114 }; 115 115 116 116 #ifdef CONFIG_VT 117 - static void sysrq_handle_SAK(int key) 117 + static void sysrq_handle_SAK(u8 key) 118 118 { 119 119 struct work_struct *SAK_work = &vc_cons[fg_console].SAK_work; 120 120 ··· 131 131 #endif 132 132 133 133 #ifdef CONFIG_VT 134 - static void sysrq_handle_unraw(int key) 134 + static void sysrq_handle_unraw(u8 key) 135 135 { 136 136 vt_reset_unicode(fg_console); 137 137 } ··· 146 146 #define sysrq_unraw_op (*(const struct sysrq_key_op *)NULL) 147 147 #endif /* CONFIG_VT */ 148 148 149 - static void sysrq_handle_crash(int key) 149 + static void sysrq_handle_crash(u8 key) 150 150 { 151 151 /* release the RCU read lock before crashing */ 152 152 rcu_read_unlock(); ··· 160 160 .enable_mask = SYSRQ_ENABLE_DUMP, 161 161 }; 162 162 163 - static void sysrq_handle_reboot(int key) 163 + static void sysrq_handle_reboot(u8 key) 164 164 { 165 165 lockdep_off(); 166 166 local_irq_enable(); ··· 175 175 176 176 const struct sysrq_key_op *__sysrq_reboot_op = &sysrq_reboot_op; 177 177 178 - static void sysrq_handle_sync(int key) 178 + static void sysrq_handle_sync(u8 key) 179 179 { 180 180 emergency_sync(); 181 181 } ··· 186 186 .enable_mask = SYSRQ_ENABLE_SYNC, 187 187 }; 188 188 189 - static void sysrq_handle_show_timers(int key) 189 + static void sysrq_handle_show_timers(u8 key) 190 190 { 191 191 sysrq_timer_list_show(); 192 192 } ··· 197 197 .action_msg = "Show clockevent devices & pending hrtimers (no others)", 198 198 }; 199 199 200 - static void sysrq_handle_mountro(int key) 200 + static void sysrq_handle_mountro(u8 key) 201 201 { 202 202 emergency_remount(); 203 203 } ··· 209 209 }; 210 210 211 211 #ifdef CONFIG_LOCKDEP 212 - static void sysrq_handle_showlocks(int key) 212 + static void sysrq_handle_showlocks(u8 key) 213 213 { 214 214 debug_show_all_locks(); 215 215 } ··· 249 249 250 250 static DECLARE_WORK(sysrq_showallcpus, sysrq_showregs_othercpus); 251 251 252 - static void sysrq_handle_showallcpus(int key) 252 + static void sysrq_handle_showallcpus(u8 key) 253 253 { 254 254 /* 255 255 * Fall back to the workqueue based printing if the ··· 282 282 #define sysrq_showallcpus_op (*(const struct sysrq_key_op *)NULL) 283 283 #endif 284 284 285 - static void sysrq_handle_showregs(int key) 285 + static void sysrq_handle_showregs(u8 key) 286 286 { 287 287 struct pt_regs *regs = NULL; 288 288 ··· 299 299 .enable_mask = SYSRQ_ENABLE_DUMP, 300 300 }; 301 301 302 - static void sysrq_handle_showstate(int key) 302 + static void sysrq_handle_showstate(u8 key) 303 303 { 304 304 show_state(); 305 305 show_all_workqueues(); ··· 311 311 .enable_mask = SYSRQ_ENABLE_DUMP, 312 312 }; 313 313 314 - static void sysrq_handle_showstate_blocked(int key) 314 + static void sysrq_handle_showstate_blocked(u8 key) 315 315 { 316 316 show_state_filter(TASK_UNINTERRUPTIBLE); 317 317 } ··· 325 325 #ifdef CONFIG_TRACING 326 326 #include <linux/ftrace.h> 327 327 328 - static void sysrq_ftrace_dump(int key) 328 + static void sysrq_ftrace_dump(u8 key) 329 329 { 330 330 ftrace_dump(DUMP_ALL); 331 331 } ··· 339 339 #define sysrq_ftrace_dump_op (*(const struct sysrq_key_op *)NULL) 340 340 #endif 341 341 342 - static void sysrq_handle_showmem(int key) 342 + static void sysrq_handle_showmem(u8 key) 343 343 { 344 344 show_mem(0, NULL); 345 345 } ··· 369 369 read_unlock(&tasklist_lock); 370 370 } 371 371 372 - static void sysrq_handle_term(int key) 372 + static void sysrq_handle_term(u8 key) 373 373 { 374 374 send_sig_all(SIGTERM); 375 375 console_loglevel = CONSOLE_LOGLEVEL_DEBUG; ··· 400 400 401 401 static DECLARE_WORK(moom_work, moom_callback); 402 402 403 - static void sysrq_handle_moom(int key) 403 + static void sysrq_handle_moom(u8 key) 404 404 { 405 405 schedule_work(&moom_work); 406 406 } ··· 412 412 }; 413 413 414 414 #ifdef CONFIG_BLOCK 415 - static void sysrq_handle_thaw(int key) 415 + static void sysrq_handle_thaw(u8 key) 416 416 { 417 417 emergency_thaw_all(); 418 418 } ··· 426 426 #define sysrq_thaw_op (*(const struct sysrq_key_op *)NULL) 427 427 #endif 428 428 429 - static void sysrq_handle_kill(int key) 429 + static void sysrq_handle_kill(u8 key) 430 430 { 431 431 send_sig_all(SIGKILL); 432 432 console_loglevel = CONSOLE_LOGLEVEL_DEBUG; ··· 438 438 .enable_mask = SYSRQ_ENABLE_SIGNAL, 439 439 }; 440 440 441 - static void sysrq_handle_unrt(int key) 441 + static void sysrq_handle_unrt(u8 key) 442 442 { 443 443 normalize_rt_tasks(); 444 444 }
+1 -1
include/linux/sysrq.h
··· 30 30 #define SYSRQ_ENABLE_RTNICE 0x0100 31 31 32 32 struct sysrq_key_op { 33 - void (* const handler)(int); 33 + void (* const handler)(u8); 34 34 const char * const help_msg; 35 35 const char * const action_msg; 36 36 const int enable_mask;
+1 -1
kernel/debug/debug_core.c
··· 968 968 early_param("kgdbcon", opt_kgdb_con); 969 969 970 970 #ifdef CONFIG_MAGIC_SYSRQ 971 - static void sysrq_handle_dbg(int key) 971 + static void sysrq_handle_dbg(u8 key) 972 972 { 973 973 if (!dbg_io_ops) { 974 974 pr_crit("ERROR: No KGDB I/O module available\n");
+1 -1
kernel/power/poweroff.c
··· 23 23 24 24 static DECLARE_WORK(poweroff_work, do_poweroff); 25 25 26 - static void handle_poweroff(int key) 26 + static void handle_poweroff(u8 key) 27 27 { 28 28 /* run sysrq poweroff on boot cpu */ 29 29 schedule_work_on(cpumask_first(cpu_online_mask), &poweroff_work);
+1 -1
kernel/rcu/tree_stall.h
··· 1035 1035 module_param(sysrq_rcu, bool, 0444); 1036 1036 1037 1037 /* Dump grace-period-request information due to commandeered sysrq. */ 1038 - static void sysrq_show_rcu(int key) 1038 + static void sysrq_show_rcu(u8 key) 1039 1039 { 1040 1040 show_rcu_gp_kthreads(); 1041 1041 }