History

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.))

Jiri Slaby committed 3 years ago

Commit bcb48181 parent 00ef7ef11 files · +31 −31Browse files

Unified · Split

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