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
422422 arch_initcall(register_cpus);
423423
424424 #ifdef CONFIG_MAGIC_SYSRQ
425−static void sysrq_reboot_handler(int unused)
425+static void sysrq_reboot_handler(u8 unused)
426426 {
427427 machine_halt();
428428 }
arch/loongarch/kernel/sysrq.c+1−1
@@ -43,7 +43,7 @@ static void sysrq_tlbdump_othercpus(struct work_struct *dummy) · 42 unmodified lines
4343 static DECLARE_WORK(sysrq_tlbdump, sysrq_tlbdump_othercpus);
4444 #endif
4545
46−static void sysrq_handle_tlbdump(int key)
46+static void sysrq_handle_tlbdump(u8 key)
4747 {
4848 sysrq_tlbdump_single(NULL);
4949 #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
4444 static DECLARE_WORK(sysrq_tlbdump, sysrq_tlbdump_othercpus);
4545 #endif
4646
47−static void sysrq_handle_tlbdump(int key)
47+static void sysrq_handle_tlbdump(u8 key)
4848 {
4949 sysrq_tlbdump_single(NULL);
5050 #ifdef CONFIG_SMP
arch/powerpc/xmon/xmon.c+1−1
@@ -3991,7 +3991,7 @@ static void xmon_init(int enable) · 3990 unmodified lines
39913991 }
39923992
39933993 #ifdef CONFIG_MAGIC_SYSRQ
3994−static void sysrq_handle_xmon(int key)
3994+static void sysrq_handle_xmon(u8 key)
39953995 {
39963996 if (xmon_is_locked_down()) {
39973997 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
295295
296296 #ifdef CONFIG_MAGIC_SYSRQ
297297
298−static void sysrq_handle_globreg(int key)
298+static void sysrq_handle_globreg(u8 key)
299299 {
300300 trigger_all_cpu_backtrace();
301301 }
@@ -370,7 +370,7 @@ static void pmu_snapshot_all_cpus(void) · 68 unmodified lines
370370 spin_unlock_irqrestore(&global_cpu_snapshot_lock, flags);
371371 }
372372
373−static void sysrq_handle_globpmu(int key)
373+static void sysrq_handle_globpmu(u8 key)
374374 {
375375 pmu_snapshot_all_cpus();
376376 }
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
301301
302302 static DECLARE_WORK(drm_fb_helper_restore_work, drm_fb_helper_restore_work_fn);
303303
304−static void drm_fb_helper_sysrq(int dummy1)
304+static void drm_fb_helper_sysrq(u8 dummy1)
305305 {
306306 schedule_work(&drm_fb_helper_restore_work);
307307 }
drivers/tty/sysrq.c+20−20
@@ -98,7 +98,7 @@ static int __init sysrq_always_enabled_setup(char *str) · 97 unmodified lines
9898 __setup("sysrq_always_enabled", sysrq_always_enabled_setup);
9999
100100
101−static void sysrq_handle_loglevel(int key)
101+static void sysrq_handle_loglevel(u8 key)
102102 {
103103 u8 loglevel = key - '0';
104104
@@ -114,7 +114,7 @@ static const struct sysrq_key_op sysrq_loglevel_op = { · 9 unmodified lines
114114 };
115115
116116 #ifdef CONFIG_VT
117−static void sysrq_handle_SAK(int key)
117+static void sysrq_handle_SAK(u8 key)
118118 {
119119 struct work_struct *SAK_work = &vc_cons[fg_console].SAK_work;
120120
@@ -131,7 +131,7 @@ static const struct sysrq_key_op sysrq_SAK_op = { · 10 unmodified lines
131131 #endif
132132
133133 #ifdef CONFIG_VT
134−static void sysrq_handle_unraw(int key)
134+static void sysrq_handle_unraw(u8 key)
135135 {
136136 vt_reset_unicode(fg_console);
137137 }
@@ -146,7 +146,7 @@ static const struct sysrq_key_op sysrq_unraw_op = { · 8 unmodified lines
146146 #define sysrq_unraw_op (*(const struct sysrq_key_op *)NULL)
147147 #endif /* CONFIG_VT */
148148
149−static void sysrq_handle_crash(int key)
149+static void sysrq_handle_crash(u8 key)
150150 {
151151 /* release the RCU read lock before crashing */
152152 rcu_read_unlock();
@@ -160,7 +160,7 @@ static const struct sysrq_key_op sysrq_crash_op = { · 7 unmodified lines
160160 .enable_mask = SYSRQ_ENABLE_DUMP,
161161 };
162162
163−static void sysrq_handle_reboot(int key)
163+static void sysrq_handle_reboot(u8 key)
164164 {
165165 lockdep_off();
166166 local_irq_enable();
@@ -175,7 +175,7 @@ static const struct sysrq_key_op sysrq_reboot_op = { · 8 unmodified lines
175175
176176 const struct sysrq_key_op *__sysrq_reboot_op = &sysrq_reboot_op;
177177
178−static void sysrq_handle_sync(int key)
178+static void sysrq_handle_sync(u8 key)
179179 {
180180 emergency_sync();
181181 }
@@ -186,7 +186,7 @@ static const struct sysrq_key_op sysrq_sync_op = { · 4 unmodified lines
186186 .enable_mask = SYSRQ_ENABLE_SYNC,
187187 };
188188
189−static void sysrq_handle_show_timers(int key)
189+static void sysrq_handle_show_timers(u8 key)
190190 {
191191 sysrq_timer_list_show();
192192 }
@@ -197,7 +197,7 @@ static const struct sysrq_key_op sysrq_show_timers_op = { · 4 unmodified lines
197197 .action_msg = "Show clockevent devices & pending hrtimers (no others)",
198198 };
199199
200−static void sysrq_handle_mountro(int key)
200+static void sysrq_handle_mountro(u8 key)
201201 {
202202 emergency_remount();
203203 }
@@ -209,7 +209,7 @@ static const struct sysrq_key_op sysrq_mountro_op = { · 5 unmodified lines
209209 };
210210
211211 #ifdef CONFIG_LOCKDEP
212−static void sysrq_handle_showlocks(int key)
212+static void sysrq_handle_showlocks(u8 key)
213213 {
214214 debug_show_all_locks();
215215 }
@@ -249,7 +249,7 @@ static void sysrq_showregs_othercpus(struct work_struct *dummy) · 33 unmodified lines
249249
250250 static DECLARE_WORK(sysrq_showallcpus, sysrq_showregs_othercpus);
251251
252−static void sysrq_handle_showallcpus(int key)
252+static void sysrq_handle_showallcpus(u8 key)
253253 {
254254 /*
255255 * 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
282282 #define sysrq_showallcpus_op (*(const struct sysrq_key_op *)NULL)
283283 #endif
284284
285−static void sysrq_handle_showregs(int key)
285+static void sysrq_handle_showregs(u8 key)
286286 {
287287 struct pt_regs *regs = NULL;
288288
@@ -299,7 +299,7 @@ static const struct sysrq_key_op sysrq_showregs_op = { · 10 unmodified lines
299299 .enable_mask = SYSRQ_ENABLE_DUMP,
300300 };
301301
302−static void sysrq_handle_showstate(int key)
302+static void sysrq_handle_showstate(u8 key)
303303 {
304304 show_state();
305305 show_all_workqueues();
@@ -311,7 +311,7 @@ static const struct sysrq_key_op sysrq_showstate_op = { · 5 unmodified lines
311311 .enable_mask = SYSRQ_ENABLE_DUMP,
312312 };
313313
314−static void sysrq_handle_showstate_blocked(int key)
314+static void sysrq_handle_showstate_blocked(u8 key)
315315 {
316316 show_state_filter(TASK_UNINTERRUPTIBLE);
317317 }
@@ -325,7 +325,7 @@ static const struct sysrq_key_op sysrq_showstate_blocked_op = { · 7 unmodified lines
325325 #ifdef CONFIG_TRACING
326326 #include <linux/ftrace.h>
327327
328−static void sysrq_ftrace_dump(int key)
328+static void sysrq_ftrace_dump(u8 key)
329329 {
330330 ftrace_dump(DUMP_ALL);
331331 }
@@ -339,7 +339,7 @@ static const struct sysrq_key_op sysrq_ftrace_dump_op = { · 7 unmodified lines
339339 #define sysrq_ftrace_dump_op (*(const struct sysrq_key_op *)NULL)
340340 #endif
341341
342−static void sysrq_handle_showmem(int key)
342+static void sysrq_handle_showmem(u8 key)
343343 {
344344 show_mem(0, NULL);
345345 }
@@ -369,7 +369,7 @@ static void send_sig_all(int sig) · 23 unmodified lines
369369 read_unlock(&tasklist_lock);
370370 }
371371
372−static void sysrq_handle_term(int key)
372+static void sysrq_handle_term(u8 key)
373373 {
374374 send_sig_all(SIGTERM);
375375 console_loglevel = CONSOLE_LOGLEVEL_DEBUG;
@@ -400,7 +400,7 @@ static void moom_callback(struct work_struct *ignored) · 24 unmodified lines
400400
401401 static DECLARE_WORK(moom_work, moom_callback);
402402
403−static void sysrq_handle_moom(int key)
403+static void sysrq_handle_moom(u8 key)
404404 {
405405 schedule_work(&moom_work);
406406 }
@@ -412,7 +412,7 @@ static const struct sysrq_key_op sysrq_moom_op = { · 5 unmodified lines
412412 };
413413
414414 #ifdef CONFIG_BLOCK
415−static void sysrq_handle_thaw(int key)
415+static void sysrq_handle_thaw(u8 key)
416416 {
417417 emergency_thaw_all();
418418 }
@@ -426,7 +426,7 @@ static const struct sysrq_key_op sysrq_thaw_op = { · 7 unmodified lines
426426 #define sysrq_thaw_op (*(const struct sysrq_key_op *)NULL)
427427 #endif
428428
429−static void sysrq_handle_kill(int key)
429+static void sysrq_handle_kill(u8 key)
430430 {
431431 send_sig_all(SIGKILL);
432432 console_loglevel = CONSOLE_LOGLEVEL_DEBUG;
@@ -438,7 +438,7 @@ static const struct sysrq_key_op sysrq_kill_op = { · 5 unmodified lines
438438 .enable_mask = SYSRQ_ENABLE_SIGNAL,
439439 };
440440
441−static void sysrq_handle_unrt(int key)
441+static void sysrq_handle_unrt(u8 key)
442442 {
443443 normalize_rt_tasks();
444444 }
include/linux/sysrq.h+1−1
@@ -30,7 +30,7 @@ · 29 unmodified lines
3030 #define SYSRQ_ENABLE_RTNICE 0x0100
3131
3232 struct sysrq_key_op {
33− void (* const handler)(int);
33+ void (* const handler)(u8);
3434 const char * const help_msg;
3535 const char * const action_msg;
3636 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
968968 early_param("kgdbcon", opt_kgdb_con);
969969
970970 #ifdef CONFIG_MAGIC_SYSRQ
971−static void sysrq_handle_dbg(int key)
971+static void sysrq_handle_dbg(u8 key)
972972 {
973973 if (!dbg_io_ops) {
974974 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
2323
2424 static DECLARE_WORK(poweroff_work, do_poweroff);
2525
26−static void handle_poweroff(int key)
26+static void handle_poweroff(u8 key)
2727 {
2828 /* run sysrq poweroff on boot cpu */
2929 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
10351035 module_param(sysrq_rcu, bool, 0444);
10361036
10371037 /* 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)
10391039 {
10401040 show_rcu_gp_kthreads();
10411041 }