tty: u8 conversion preparation
Subsystems (32)
Jiri Slaby (SUSE)
maintainercover tty: u8 conversion preparation
This is another round of preparations for conversions of chars and flags to u8. This series converts sysrq handlers and serial_core + serial drivers. The tty proper will be posted separately later.
Jiri Slaby (SUSE) (10):
tty: sysrq: rename and re-type i in sysrq_handle_loglevel()
tty: sysrq: switch sysrq handlers from int to u8
tty: sysrq: switch the rest of keys to u8
tty: sysrq: use switch in sysrq_key_table_key2index()
serial: convert uart sysrq handling to u8
serial: make uart_insert_char() accept u8s
serial: pass state to __uart_start() directly
serial: arc_uart: simplify flags handling in arc_serial_rx_chars()
serial: omap-serial: remove flag from serial_omap_rdi()
serial: drivers: switch ch and flag to u8
arch/alpha/kernel/setup.c | 2 +- arch/loongarch/kernel/sysrq.c | 2 +- arch/mips/kernel/sysrq.c | 2 +- arch/powerpc/xmon/xmon.c | 2 +- arch/sparc/kernel/process_64.c | 4 +- drivers/gpu/drm/drm_fb_helper.c | 2 +- drivers/tty/serial/21285.c | 3 +- drivers/tty/serial/8250/8250_port.c | 3 +- drivers/tty/serial/altera_jtaguart.c | 2 +- drivers/tty/serial/altera_uart.c | 2 +- drivers/tty/serial/amba-pl010.c | 3 +- drivers/tty/serial/amba-pl011.c | 3 +- drivers/tty/serial/apbuart.c | 3 +- drivers/tty/serial/arc_uart.c | 29 +++++----- drivers/tty/serial/atmel_serial.c | 2 +- drivers/tty/serial/clps711x.c | 3 +- drivers/tty/serial/digicolor-usart.c | 3 +- drivers/tty/serial/dz.c | 2 +- drivers/tty/serial/ip22zilog.c | 2 +- drivers/tty/serial/max3100.c | 3 +- drivers/tty/serial/max310x.c | 3 +- drivers/tty/serial/mcf.c | 2 +- drivers/tty/serial/milbeaut_usio.c | 3 +- drivers/tty/serial/mxs-auart.c | 3 +- drivers/tty/serial/omap-serial.c | 8 +-- drivers/tty/serial/pxa.c | 2 +- drivers/tty/serial/rp2.c | 4 +- drivers/tty/serial/sa1100.c | 3 +- drivers/tty/serial/samsung_tty.c | 3 +- drivers/tty/serial/sb1250-duart.c | 3 +- drivers/tty/serial/sc16is7xx.c | 3 +- drivers/tty/serial/sccnxp.c | 3 +- drivers/tty/serial/serial-tegra.c | 7 +-- drivers/tty/serial/serial_core.c | 15 +++-- drivers/tty/serial/serial_txx9.c | 3 +- drivers/tty/serial/sifive.c | 2 +- drivers/tty/serial/sprd_serial.c | 5 +- drivers/tty/serial/st-asc.c | 2 +- drivers/tty/serial/stm32-usart.c | 5 +- drivers/tty/serial/sunplus-uart.c | 2 +- drivers/tty/serial/zs.c | 3 +- drivers/tty/sysrq.c | 84 ++++++++++++++-------------- include/linux/serial_core.h | 18 +++--- include/linux/sysrq.h | 18 +++--- kernel/debug/debug_core.c | 2 +- kernel/power/poweroff.c | 2 +- kernel/rcu/tree_stall.h | 2 +- 47 files changed, 142 insertions(+), 145 deletions(-)
Signature · 1 line
2.41.0
Jiri Slaby (SUSE)
maintainerPATCH 1/10 tty: sysrq: rename and re-type i in sysrq_handle_loglevel()
'i' is a too generic name for something which carries a 'loglevel'. Name it as such and make it 'u8', the same as key will become in the next patches.
Note that we are not stripping any high bits away, 'key' is given only 8bit values.
--- drivers/tty/sysrq.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/tty/sysrq.c +3 -4
@@ -100,12 +100,11 @@ __setup("sysrq_always_enabled", sysrq_always_enabled_setup);static void sysrq_handle_loglevel (int key) { -int i; +u8 loglevel = key -'0' ; - i = key -'0' ; console_loglevel =CONSOLE_LOGLEVEL_DEFAULT ; -pr_info ("Loglevel set to %d\n" , i); - console_loglevel = i; +pr_info ("Loglevel set to %u\n" , loglevel); + console_loglevel = loglevel; }static const struct sysrq_key_op sysrq_loglevel_op = { .handler = sysrq_handle_loglevel,
Signature · 1 line
2.41.0
Jiri Slaby (SUSE)
maintainerPATCH 2/10 tty: sysrq: switch sysrq handlers from int to u8
In reply to Jiri Slaby (SUSE)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.))
--- arch/alpha/kernel/setup.c | 2 +- arch/loongarch/kernel/sysrq.c | 2 +- arch/mips/kernel/sysrq.c | 2 +- arch/powerpc/xmon/xmon.c | 2 +- arch/sparc/kernel/process_64.c | 4 ++-- drivers/gpu/drm/drm_fb_helper.c | 2 +- drivers/tty/sysrq.c | 40 ++++++++++++++++----------------- include/linux/sysrq.h | 2 +- kernel/debug/debug_core.c | 2 +- kernel/power/poweroff.c | 2 +- kernel/rcu/tree_stall.h | 2 +- 11 files changed, 31 insertions(+), 31 deletions(-)
arch/alpha/kernel/setup.c +1 -1
@@ -422,7 +422,7 @@ register_cpus(void)arch_initcall (register_cpus);#ifdef CONFIG_MAGIC_SYSRQ -static void sysrq_reboot_handler (int unused) +static void sysrq_reboot_handler (u8 unused) {machine_halt (); }
arch/loongarch/kernel/sysrq.c +1 -1
@@ -43,7 +43,7 @@ static void sysrq_tlbdump_othercpus(struct work_struct *dummy) static DECLARE_WORK(sysrq_tlbdump, sysrq_tlbdump_othercpus);#endif -static void sysrq_handle_tlbdump (int key) +static void sysrq_handle_tlbdump (u8 key) {sysrq_tlbdump_single (NULL );#ifdef CONFIG_SMP
arch/mips/kernel/sysrq.c +1 -1
@@ -44,7 +44,7 @@ static void sysrq_tlbdump_othercpus(struct work_struct *dummy) static DECLARE_WORK(sysrq_tlbdump, sysrq_tlbdump_othercpus);#endif -static void sysrq_handle_tlbdump (int key) +static void sysrq_handle_tlbdump (u8 key) {sysrq_tlbdump_single (NULL );#ifdef CONFIG_SMP
arch/powerpc/xmon/xmon.c +1 -1
@@ -3991,7 +3991,7 @@ static void xmon_init(int enable) }#ifdef CONFIG_MAGIC_SYSRQ -static void sysrq_handle_xmon (int key) +static void sysrq_handle_xmon (u8 key) {if (xmon_is_locked_down ()) {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)#ifdef CONFIG_MAGIC_SYSRQ -static void sysrq_handle_globreg (int key) +static void sysrq_handle_globreg (u8 key) {trigger_all_cpu_backtrace (); }
@@ -370,7 +370,7 @@ static void pmu_snapshot_all_cpus(void)spin_unlock_irqrestore (&global_cpu_snapshot_lock, flags); } -static void sysrq_handle_globpmu (int key) +static void sysrq_handle_globpmu (u8 key) {pmu_snapshot_all_cpus (); }
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) static DECLARE_WORK(drm_fb_helper_restore_work, drm_fb_helper_restore_work_fn); -static void drm_fb_helper_sysrq (int dummy1) +static void drm_fb_helper_sysrq (u8 dummy1) {schedule_work (&drm_fb_helper_restore_work); }
drivers/tty/sysrq.c +20 -20
@@ -98,7 +98,7 @@ static int __init sysrq_always_enabled_setup(char *str)__setup ("sysrq_always_enabled" , sysrq_always_enabled_setup); -static void sysrq_handle_loglevel (int key) +static void sysrq_handle_loglevel (u8 key) {u8 loglevel = key -'0' ;
@@ -114,7 +114,7 @@ static const struct sysrq_key_op sysrq_loglevel_op = { };#ifdef CONFIG_VT -static void sysrq_handle_SAK (int key) +static void sysrq_handle_SAK (u8 key) {struct work_struct *SAK_work = &vc_cons[fg_console].SAK_work;
@@ -131,7 +131,7 @@ static const struct sysrq_key_op sysrq_SAK_op = {#endif #ifdef CONFIG_VT -static void sysrq_handle_unraw (int key) +static void sysrq_handle_unraw (u8 key) {vt_reset_unicode (fg_console); }
@@ -146,7 +146,7 @@ static const struct sysrq_key_op sysrq_unraw_op = {#define sysrq_unraw_op (*(const struct sysrq_key_op *)NULL)#endif /* CONFIG_VT */ -static void sysrq_handle_crash (int key) +static void sysrq_handle_crash (u8 key) {/* release the RCU read lock before crashing */ rcu_read_unlock ();
@@ -160,7 +160,7 @@ static const struct sysrq_key_op sysrq_crash_op = { .enable_mask = SYSRQ_ENABLE_DUMP, }; -static void sysrq_handle_reboot (int key) +static void sysrq_handle_reboot (u8 key) {lockdep_off ();local_irq_enable ();
@@ -175,7 +175,7 @@ static const struct sysrq_key_op sysrq_reboot_op = {const struct sysrq_key_op *__sysrq_reboot_op = &sysrq_reboot_op; -static void sysrq_handle_sync (int key) +static void sysrq_handle_sync (u8 key) {emergency_sync (); }
@@ -186,7 +186,7 @@ static const struct sysrq_key_op sysrq_sync_op = { .enable_mask = SYSRQ_ENABLE_SYNC, }; -static void sysrq_handle_show_timers (int key) +static void sysrq_handle_show_timers (u8 key) {sysrq_timer_list_show (); }
@@ -197,7 +197,7 @@ static const struct sysrq_key_op sysrq_show_timers_op = { .action_msg = "Show clockevent devices & pending hrtimers (no others)", }; -static void sysrq_handle_mountro (int key) +static void sysrq_handle_mountro (u8 key) {emergency_remount (); }
@@ -209,7 +209,7 @@ static const struct sysrq_key_op sysrq_mountro_op = { };#ifdef CONFIG_LOCKDEP -static void sysrq_handle_showlocks (int key) +static void sysrq_handle_showlocks (u8 key) {debug_show_all_locks (); }
@@ -249,7 +249,7 @@ static void sysrq_showregs_othercpus(struct work_struct *dummy) static DECLARE_WORK(sysrq_showallcpus, sysrq_showregs_othercpus); -static void sysrq_handle_showallcpus (int key) +static void sysrq_handle_showallcpus (u8 key) {/* * Fall back to the workqueue based printing if the
@@ -282,7 +282,7 @@ static const struct sysrq_key_op sysrq_showallcpus_op = {#define sysrq_showallcpus_op (*(const struct sysrq_key_op *)NULL)#endif -static void sysrq_handle_showregs (int key) +static void sysrq_handle_showregs (u8 key) {struct pt_regs *regs =NULL ;
@@ -299,7 +299,7 @@ static const struct sysrq_key_op sysrq_showregs_op = { .enable_mask = SYSRQ_ENABLE_DUMP, }; -static void sysrq_handle_showstate (int key) +static void sysrq_handle_showstate (u8 key) {show_state ();show_all_workqueues ();
@@ -311,7 +311,7 @@ static const struct sysrq_key_op sysrq_showstate_op = { .enable_mask = SYSRQ_ENABLE_DUMP, }; -static void sysrq_handle_showstate_blocked (int key) +static void sysrq_handle_showstate_blocked (u8 key) {show_state_filter (TASK_UNINTERRUPTIBLE ); }
@@ -325,7 +325,7 @@ static const struct sysrq_key_op sysrq_showstate_blocked_op = {#ifdef CONFIG_TRACING #include <linux/ftrace.h> -static void sysrq_ftrace_dump (int key) +static void sysrq_ftrace_dump (u8 key) {ftrace_dump (DUMP_ALL ); }
@@ -339,7 +339,7 @@ static const struct sysrq_key_op sysrq_ftrace_dump_op = {#define sysrq_ftrace_dump_op (*(const struct sysrq_key_op *)NULL)#endif -static void sysrq_handle_showmem (int key) +static void sysrq_handle_showmem (u8 key) {show_mem (); }
@@ -369,7 +369,7 @@ static void send_sig_all(int sig)read_unlock (&tasklist_lock); } -static void sysrq_handle_term (int key) +static void sysrq_handle_term (u8 key) {send_sig_all (SIGTERM ); console_loglevel =CONSOLE_LOGLEVEL_DEBUG ;
@@ -400,7 +400,7 @@ static void moom_callback(struct work_struct *ignored) static DECLARE_WORK(moom_work, moom_callback); -static void sysrq_handle_moom (int key) +static void sysrq_handle_moom (u8 key) {schedule_work (&moom_work); }
@@ -412,7 +412,7 @@ static const struct sysrq_key_op sysrq_moom_op = { };#ifdef CONFIG_BLOCK -static void sysrq_handle_thaw (int key) +static void sysrq_handle_thaw (u8 key) {emergency_thaw_all (); }
@@ -426,7 +426,7 @@ static const struct sysrq_key_op sysrq_thaw_op = {#define sysrq_thaw_op (*(const struct sysrq_key_op *)NULL)#endif -static void sysrq_handle_kill (int key) +static void sysrq_handle_kill (u8 key) {send_sig_all (SIGKILL ); console_loglevel =CONSOLE_LOGLEVEL_DEBUG ;
@@ -438,7 +438,7 @@ static const struct sysrq_key_op sysrq_kill_op = { .enable_mask = SYSRQ_ENABLE_SIGNAL, }; -static void sysrq_handle_unrt (int key) +static void sysrq_handle_unrt (u8 key) {normalize_rt_tasks (); }
include/linux/sysrq.h +1 -1
@@ -30,7 +30,7 @@#define SYSRQ_ENABLE_RTNICE 0x0100struct sysrq_key_op { -void (*const handler)(int ); +void (*const handler)(u8 );const char *const help_msg;const char *const action_msg;const int enable_mask;
kernel/debug/debug_core.c +1 -1
@@ -968,7 +968,7 @@ static int __init opt_kgdb_con(char *str)early_param ("kgdbcon" , opt_kgdb_con);#ifdef CONFIG_MAGIC_SYSRQ -static void sysrq_handle_dbg (int key) +static void sysrq_handle_dbg (u8 key) {if (!dbg_io_ops) {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) static DECLARE_WORK(poweroff_work, do_poweroff); -static void handle_poweroff (int key) +static void handle_poweroff (u8 key) {/* run sysrq poweroff on boot cpu */ 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;module_param (sysrq_rcu, bool,0444 );/* Dump grace-period-request information due to commandeered sysrq. */ -static void sysrq_show_rcu (int key) +static void sysrq_show_rcu (u8 key) {show_rcu_gp_kthreads (); }
Signature · 1 line
2.41.0
Re: [PATCH 02/10] tty: sysrq: switch sysrq handlers from int to u8
Am 12.07.23 um 10:18 schrieb Jiri Slaby (SUSE):
Quoted 34 lines
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) <[email protected]>Cc Richard Henderson <[email protected]>Cc Ivan Kokshaysky <[email protected]>Cc Matt Turner <[email protected]>Cc Huacai Chen <[email protected]>Cc WANG Xuerui <[email protected]>Cc Thomas Bogendoerfer <[email protected]>Cc Michael Ellerman <[email protected]>Cc Nicholas Piggin <[email protected]>Cc Christophe Leroy <[email protected]>Cc "David S. Miller" <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc Thomas Zimmermann <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Cc Jason Wessel <[email protected]>Cc Daniel Thompson <[email protected]>Cc Douglas Anderson <[email protected]>Cc "Rafael J. Wysocki" <[email protected]>Cc Len Brown <[email protected]>Cc Pavel Machek <[email protected]>Cc "Paul E. McKenney" <[email protected]>Cc Frederic Weisbecker <[email protected]>
Quoted 8 lines
Cc Neeraj Upadhyay <[email protected]>Cc Joel Fernandes <[email protected]>Cc Josh Triplett <[email protected]>Cc Boqun Feng <[email protected]>Cc Steven Rostedt <[email protected]>Cc Mathieu Desnoyers <[email protected]>Cc Lai Jiangshan <[email protected]>Cc Zqiang <[email protected]>
Quoted 337 lines
--- arch/alpha/kernel/setup.c | 2 +- arch/loongarch/kernel/sysrq.c | 2 +- arch/mips/kernel/sysrq.c | 2 +- arch/powerpc/xmon/xmon.c | 2 +- arch/sparc/kernel/process_64.c | 4 ++-- drivers/gpu/drm/drm_fb_helper.c | 2 +- drivers/tty/sysrq.c | 40 ++++++++++++++++----------------- include/linux/sysrq.h | 2 +- kernel/debug/debug_core.c | 2 +- kernel/power/poweroff.c | 2 +- kernel/rcu/tree_stall.h | 2 +- 11 files changed, 31 insertions(+), 31 deletions(-)arch/alpha/kernel/setup.c +1
-1@@ -422,7 +422,7 @@ register_cpus(void)arch_initcall (register_cpus);#ifdef CONFIG_MAGIC_SYSRQ -static void sysrq_reboot_handler (int unused) +static void sysrq_reboot_handler (u8 unused) {machine_halt (); }arch/loongarch/kernel/sysrq.c +1
-1@@ -43,7 +43,7 @@ static void sysrq_tlbdump_othercpus(struct work_struct *dummy) static DECLARE_WORK(sysrq_tlbdump, sysrq_tlbdump_othercpus);#endif -static void sysrq_handle_tlbdump (int key) +static void sysrq_handle_tlbdump (u8 key) {sysrq_tlbdump_single (NULL );#ifdef CONFIG_SMP arch/mips/kernel/sysrq.c +1
-1@@ -44,7 +44,7 @@ static void sysrq_tlbdump_othercpus(struct work_struct *dummy) static DECLARE_WORK(sysrq_tlbdump, sysrq_tlbdump_othercpus);#endif -static void sysrq_handle_tlbdump (int key) +static void sysrq_handle_tlbdump (u8 key) {sysrq_tlbdump_single (NULL );#ifdef CONFIG_SMP arch/powerpc/xmon/xmon.c +1
-1@@ -3991,7 +3991,7 @@ static void xmon_init(int enable) }#ifdef CONFIG_MAGIC_SYSRQ -static void sysrq_handle_xmon (int key) +static void sysrq_handle_xmon (u8 key) {if (xmon_is_locked_down ()) {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)#ifdef CONFIG_MAGIC_SYSRQ -static void sysrq_handle_globreg (int key) +static void sysrq_handle_globreg (u8 key) {trigger_all_cpu_backtrace (); }@@ -370,7 +370,7 @@ static void pmu_snapshot_all_cpus(void)spin_unlock_irqrestore (&global_cpu_snapshot_lock, flags); } -static void sysrq_handle_globpmu (int key) +static void sysrq_handle_globpmu (u8 key) {pmu_snapshot_all_cpus (); }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) static DECLARE_WORK(drm_fb_helper_restore_work, drm_fb_helper_restore_work_fn); -static void drm_fb_helper_sysrq (int dummy1) +static void drm_fb_helper_sysrq (u8 dummy1) {schedule_work (&drm_fb_helper_restore_work); }drivers/tty/sysrq.c +20
-20@@ -98,7 +98,7 @@ static int __init sysrq_always_enabled_setup(char *str)__setup ("sysrq_always_enabled" , sysrq_always_enabled_setup); -static void sysrq_handle_loglevel (int key) +static void sysrq_handle_loglevel (u8 key) {u8 loglevel = key -'0' ;@@ -114,7 +114,7 @@ static const struct sysrq_key_op sysrq_loglevel_op = { };#ifdef CONFIG_VT -static void sysrq_handle_SAK (int key) +static void sysrq_handle_SAK (u8 key) {struct work_struct *SAK_work = &vc_cons[fg_console].SAK_work;@@ -131,7 +131,7 @@ static const struct sysrq_key_op sysrq_SAK_op = {#endif #ifdef CONFIG_VT -static void sysrq_handle_unraw (int key) +static void sysrq_handle_unraw (u8 key) {vt_reset_unicode (fg_console); }@@ -146,7 +146,7 @@ static const struct sysrq_key_op sysrq_unraw_op = {#define sysrq_unraw_op (*(const struct sysrq_key_op *)NULL)#endif /* CONFIG_VT */ -static void sysrq_handle_crash (int key) +static void sysrq_handle_crash (u8 key) {/* release the RCU read lock before crashing */ rcu_read_unlock ();@@ -160,7 +160,7 @@ static const struct sysrq_key_op sysrq_crash_op = { .enable_mask = SYSRQ_ENABLE_DUMP, }; -static void sysrq_handle_reboot (int key) +static void sysrq_handle_reboot (u8 key) {lockdep_off ();local_irq_enable ();@@ -175,7 +175,7 @@ static const struct sysrq_key_op sysrq_reboot_op = {const struct sysrq_key_op *__sysrq_reboot_op = &sysrq_reboot_op; -static void sysrq_handle_sync (int key) +static void sysrq_handle_sync (u8 key) {emergency_sync (); }@@ -186,7 +186,7 @@ static const struct sysrq_key_op sysrq_sync_op = { .enable_mask = SYSRQ_ENABLE_SYNC, }; -static void sysrq_handle_show_timers (int key) +static void sysrq_handle_show_timers (u8 key) {sysrq_timer_list_show (); }@@ -197,7 +197,7 @@ static const struct sysrq_key_op sysrq_show_timers_op = { .action_msg = "Show clockevent devices & pending hrtimers (no others)", }; -static void sysrq_handle_mountro (int key) +static void sysrq_handle_mountro (u8 key) {emergency_remount (); }@@ -209,7 +209,7 @@ static const struct sysrq_key_op sysrq_mountro_op = { };#ifdef CONFIG_LOCKDEP -static void sysrq_handle_showlocks (int key) +static void sysrq_handle_showlocks (u8 key) {debug_show_all_locks (); }@@ -249,7 +249,7 @@ static void sysrq_showregs_othercpus(struct work_struct *dummy) static DECLARE_WORK(sysrq_showallcpus, sysrq_showregs_othercpus); -static void sysrq_handle_showallcpus (int key) +static void sysrq_handle_showallcpus (u8 key) {/* * Fall back to the workqueue based printing if the @@ -282,7 +282,7 @@ static const struct sysrq_key_op sysrq_showallcpus_op = {#define sysrq_showallcpus_op (*(const struct sysrq_key_op *)NULL)#endif -static void sysrq_handle_showregs (int key) +static void sysrq_handle_showregs (u8 key) {struct pt_regs *regs =NULL ;@@ -299,7 +299,7 @@ static const struct sysrq_key_op sysrq_showregs_op = { .enable_mask = SYSRQ_ENABLE_DUMP, }; -static void sysrq_handle_showstate (int key) +static void sysrq_handle_showstate (u8 key) {show_state ();show_all_workqueues ();@@ -311,7 +311,7 @@ static const struct sysrq_key_op sysrq_showstate_op = { .enable_mask = SYSRQ_ENABLE_DUMP, }; -static void sysrq_handle_showstate_blocked (int key) +static void sysrq_handle_showstate_blocked (u8 key) {show_state_filter (TASK_UNINTERRUPTIBLE ); }@@ -325,7 +325,7 @@ static const struct sysrq_key_op sysrq_showstate_blocked_op = {#ifdef CONFIG_TRACING #include <linux/ftrace.h> -static void sysrq_ftrace_dump (int key) +static void sysrq_ftrace_dump (u8 key) {ftrace_dump (DUMP_ALL ); }@@ -339,7 +339,7 @@ static const struct sysrq_key_op sysrq_ftrace_dump_op = {#define sysrq_ftrace_dump_op (*(const struct sysrq_key_op *)NULL)#endif -static void sysrq_handle_showmem (int key) +static void sysrq_handle_showmem (u8 key) {show_mem (); }@@ -369,7 +369,7 @@ static void send_sig_all(int sig)read_unlock (&tasklist_lock); } -static void sysrq_handle_term (int key) +static void sysrq_handle_term (u8 key) {send_sig_all (SIGTERM ); console_loglevel =CONSOLE_LOGLEVEL_DEBUG ;@@ -400,7 +400,7 @@ static void moom_callback(struct work_struct *ignored) static DECLARE_WORK(moom_work, moom_callback); -static void sysrq_handle_moom (int key) +static void sysrq_handle_moom (u8 key) {schedule_work (&moom_work); }@@ -412,7 +412,7 @@ static const struct sysrq_key_op sysrq_moom_op = { };#ifdef CONFIG_BLOCK -static void sysrq_handle_thaw (int key) +static void sysrq_handle_thaw (u8 key) {emergency_thaw_all (); }@@ -426,7 +426,7 @@ static const struct sysrq_key_op sysrq_thaw_op = {#define sysrq_thaw_op (*(const struct sysrq_key_op *)NULL)#endif -static void sysrq_handle_kill (int key) +static void sysrq_handle_kill (u8 key) {send_sig_all (SIGKILL ); console_loglevel =CONSOLE_LOGLEVEL_DEBUG ;@@ -438,7 +438,7 @@ static const struct sysrq_key_op sysrq_kill_op = { .enable_mask = SYSRQ_ENABLE_SIGNAL, }; -static void sysrq_handle_unrt (int key) +static void sysrq_handle_unrt (u8 key) {normalize_rt_tasks (); }include/linux/sysrq.h +1
-1@@ -30,7 +30,7 @@#define SYSRQ_ENABLE_RTNICE 0x0100struct sysrq_key_op { -void (*const handler)(int ); +void (*const handler)(u8 );const char *const help_msg;const char *const action_msg;const int enable_mask;kernel/debug/debug_core.c +1
-1@@ -968,7 +968,7 @@ static int __init opt_kgdb_con(char *str)early_param ("kgdbcon" , opt_kgdb_con);#ifdef CONFIG_MAGIC_SYSRQ -static void sysrq_handle_dbg (int key) +static void sysrq_handle_dbg (u8 key) {if (!dbg_io_ops) {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) static DECLARE_WORK(poweroff_work, do_poweroff); -static void handle_poweroff (int key) +static void handle_poweroff (u8 key) {/* run sysrq poweroff on boot cpu */ 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;module_param (sysrq_rcu, bool,0444 );/* Dump grace-period-request information due to commandeered sysrq. */ -static void sysrq_show_rcu (int key) +static void sysrq_show_rcu (u8 key) {show_rcu_gp_kthreads (); }
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Re: [PATCH 02/10] tty: sysrq: switch sysrq handlers from int to u8
In reply to Jiri Slaby (SUSE)Quoted 34 lines · Jiri Slaby (SUSE)
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) <[email protected]>Cc Richard Henderson <[email protected]>Cc Ivan Kokshaysky <[email protected]>Cc Matt Turner <[email protected]>Cc Huacai Chen <[email protected]>Cc WANG Xuerui <[email protected]>Cc Thomas Bogendoerfer <[email protected]>Cc Michael Ellerman <[email protected]>Cc Nicholas Piggin <[email protected]>Cc Christophe Leroy <[email protected]>Cc "David S. Miller" <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc Thomas Zimmermann <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Cc Jason Wessel <[email protected]>Cc Daniel Thompson <[email protected]>Cc Douglas Anderson <[email protected]>Cc "Rafael J. Wysocki" <[email protected]>Cc Len Brown <[email protected]>Cc Pavel Machek <[email protected]>Cc "Paul E. McKenney" <[email protected]>Cc Frederic Weisbecker <[email protected]>
Quoted 8 lines
Cc Neeraj Upadhyay <[email protected]>Cc Joel Fernandes <[email protected]>Cc Josh Triplett <[email protected]>Cc Boqun Feng <[email protected]>Cc Steven Rostedt <[email protected]>Cc Mathieu Desnoyers <[email protected]>Cc Lai Jiangshan <[email protected]>Cc Zqiang <[email protected]>
From an RCU perspective:
Quoted 340 lines
--- arch/alpha/kernel/setup.c | 2 +- arch/loongarch/kernel/sysrq.c | 2 +- arch/mips/kernel/sysrq.c | 2 +- arch/powerpc/xmon/xmon.c | 2 +- arch/sparc/kernel/process_64.c | 4 ++-- drivers/gpu/drm/drm_fb_helper.c | 2 +- drivers/tty/sysrq.c | 40 ++++++++++++++++----------------- include/linux/sysrq.h | 2 +- kernel/debug/debug_core.c | 2 +- kernel/power/poweroff.c | 2 +- kernel/rcu/tree_stall.h | 2 +- 11 files changed, 31 insertions(+), 31 deletions(-)arch/alpha/kernel/setup.c +1
-1@@ -422,7 +422,7 @@ register_cpus(void)arch_initcall (register_cpus);#ifdef CONFIG_MAGIC_SYSRQ -static void sysrq_reboot_handler (int unused) +static void sysrq_reboot_handler (u8 unused) {machine_halt (); }arch/loongarch/kernel/sysrq.c +1
-1@@ -43,7 +43,7 @@ static void sysrq_tlbdump_othercpus(struct work_struct *dummy) static DECLARE_WORK(sysrq_tlbdump, sysrq_tlbdump_othercpus);#endif -static void sysrq_handle_tlbdump (int key) +static void sysrq_handle_tlbdump (u8 key) {sysrq_tlbdump_single (NULL );#ifdef CONFIG_SMP arch/mips/kernel/sysrq.c +1
-1@@ -44,7 +44,7 @@ static void sysrq_tlbdump_othercpus(struct work_struct *dummy) static DECLARE_WORK(sysrq_tlbdump, sysrq_tlbdump_othercpus);#endif -static void sysrq_handle_tlbdump (int key) +static void sysrq_handle_tlbdump (u8 key) {sysrq_tlbdump_single (NULL );#ifdef CONFIG_SMP arch/powerpc/xmon/xmon.c +1
-1@@ -3991,7 +3991,7 @@ static void xmon_init(int enable) }#ifdef CONFIG_MAGIC_SYSRQ -static void sysrq_handle_xmon (int key) +static void sysrq_handle_xmon (u8 key) {if (xmon_is_locked_down ()) {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)#ifdef CONFIG_MAGIC_SYSRQ -static void sysrq_handle_globreg (int key) +static void sysrq_handle_globreg (u8 key) {trigger_all_cpu_backtrace (); }@@ -370,7 +370,7 @@ static void pmu_snapshot_all_cpus(void)spin_unlock_irqrestore (&global_cpu_snapshot_lock, flags); } -static void sysrq_handle_globpmu (int key) +static void sysrq_handle_globpmu (u8 key) {pmu_snapshot_all_cpus (); }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) static DECLARE_WORK(drm_fb_helper_restore_work, drm_fb_helper_restore_work_fn); -static void drm_fb_helper_sysrq (int dummy1) +static void drm_fb_helper_sysrq (u8 dummy1) {schedule_work (&drm_fb_helper_restore_work); }drivers/tty/sysrq.c +20
-20@@ -98,7 +98,7 @@ static int __init sysrq_always_enabled_setup(char *str)__setup ("sysrq_always_enabled" , sysrq_always_enabled_setup); -static void sysrq_handle_loglevel (int key) +static void sysrq_handle_loglevel (u8 key) {u8 loglevel = key -'0' ;@@ -114,7 +114,7 @@ static const struct sysrq_key_op sysrq_loglevel_op = { };#ifdef CONFIG_VT -static void sysrq_handle_SAK (int key) +static void sysrq_handle_SAK (u8 key) {struct work_struct *SAK_work = &vc_cons[fg_console].SAK_work;@@ -131,7 +131,7 @@ static const struct sysrq_key_op sysrq_SAK_op = {#endif #ifdef CONFIG_VT -static void sysrq_handle_unraw (int key) +static void sysrq_handle_unraw (u8 key) {vt_reset_unicode (fg_console); }@@ -146,7 +146,7 @@ static const struct sysrq_key_op sysrq_unraw_op = {#define sysrq_unraw_op (*(const struct sysrq_key_op *)NULL)#endif /* CONFIG_VT */ -static void sysrq_handle_crash (int key) +static void sysrq_handle_crash (u8 key) {/* release the RCU read lock before crashing */ rcu_read_unlock ();@@ -160,7 +160,7 @@ static const struct sysrq_key_op sysrq_crash_op = { .enable_mask = SYSRQ_ENABLE_DUMP, }; -static void sysrq_handle_reboot (int key) +static void sysrq_handle_reboot (u8 key) {lockdep_off ();local_irq_enable ();@@ -175,7 +175,7 @@ static const struct sysrq_key_op sysrq_reboot_op = {const struct sysrq_key_op *__sysrq_reboot_op = &sysrq_reboot_op; -static void sysrq_handle_sync (int key) +static void sysrq_handle_sync (u8 key) {emergency_sync (); }@@ -186,7 +186,7 @@ static const struct sysrq_key_op sysrq_sync_op = { .enable_mask = SYSRQ_ENABLE_SYNC, }; -static void sysrq_handle_show_timers (int key) +static void sysrq_handle_show_timers (u8 key) {sysrq_timer_list_show (); }@@ -197,7 +197,7 @@ static const struct sysrq_key_op sysrq_show_timers_op = { .action_msg = "Show clockevent devices & pending hrtimers (no others)", }; -static void sysrq_handle_mountro (int key) +static void sysrq_handle_mountro (u8 key) {emergency_remount (); }@@ -209,7 +209,7 @@ static const struct sysrq_key_op sysrq_mountro_op = { };#ifdef CONFIG_LOCKDEP -static void sysrq_handle_showlocks (int key) +static void sysrq_handle_showlocks (u8 key) {debug_show_all_locks (); }@@ -249,7 +249,7 @@ static void sysrq_showregs_othercpus(struct work_struct *dummy) static DECLARE_WORK(sysrq_showallcpus, sysrq_showregs_othercpus); -static void sysrq_handle_showallcpus (int key) +static void sysrq_handle_showallcpus (u8 key) {/* * Fall back to the workqueue based printing if the @@ -282,7 +282,7 @@ static const struct sysrq_key_op sysrq_showallcpus_op = {#define sysrq_showallcpus_op (*(const struct sysrq_key_op *)NULL)#endif -static void sysrq_handle_showregs (int key) +static void sysrq_handle_showregs (u8 key) {struct pt_regs *regs =NULL ;@@ -299,7 +299,7 @@ static const struct sysrq_key_op sysrq_showregs_op = { .enable_mask = SYSRQ_ENABLE_DUMP, }; -static void sysrq_handle_showstate (int key) +static void sysrq_handle_showstate (u8 key) {show_state ();show_all_workqueues ();@@ -311,7 +311,7 @@ static const struct sysrq_key_op sysrq_showstate_op = { .enable_mask = SYSRQ_ENABLE_DUMP, }; -static void sysrq_handle_showstate_blocked (int key) +static void sysrq_handle_showstate_blocked (u8 key) {show_state_filter (TASK_UNINTERRUPTIBLE ); }@@ -325,7 +325,7 @@ static const struct sysrq_key_op sysrq_showstate_blocked_op = {#ifdef CONFIG_TRACING #include <linux/ftrace.h> -static void sysrq_ftrace_dump (int key) +static void sysrq_ftrace_dump (u8 key) {ftrace_dump (DUMP_ALL ); }@@ -339,7 +339,7 @@ static const struct sysrq_key_op sysrq_ftrace_dump_op = {#define sysrq_ftrace_dump_op (*(const struct sysrq_key_op *)NULL)#endif -static void sysrq_handle_showmem (int key) +static void sysrq_handle_showmem (u8 key) {show_mem (); }@@ -369,7 +369,7 @@ static void send_sig_all(int sig)read_unlock (&tasklist_lock); } -static void sysrq_handle_term (int key) +static void sysrq_handle_term (u8 key) {send_sig_all (SIGTERM ); console_loglevel =CONSOLE_LOGLEVEL_DEBUG ;@@ -400,7 +400,7 @@ static void moom_callback(struct work_struct *ignored) static DECLARE_WORK(moom_work, moom_callback); -static void sysrq_handle_moom (int key) +static void sysrq_handle_moom (u8 key) {schedule_work (&moom_work); }@@ -412,7 +412,7 @@ static const struct sysrq_key_op sysrq_moom_op = { };#ifdef CONFIG_BLOCK -static void sysrq_handle_thaw (int key) +static void sysrq_handle_thaw (u8 key) {emergency_thaw_all (); }@@ -426,7 +426,7 @@ static const struct sysrq_key_op sysrq_thaw_op = {#define sysrq_thaw_op (*(const struct sysrq_key_op *)NULL)#endif -static void sysrq_handle_kill (int key) +static void sysrq_handle_kill (u8 key) {send_sig_all (SIGKILL ); console_loglevel =CONSOLE_LOGLEVEL_DEBUG ;@@ -438,7 +438,7 @@ static const struct sysrq_key_op sysrq_kill_op = { .enable_mask = SYSRQ_ENABLE_SIGNAL, }; -static void sysrq_handle_unrt (int key) +static void sysrq_handle_unrt (u8 key) {normalize_rt_tasks (); }include/linux/sysrq.h +1
-1@@ -30,7 +30,7 @@#define SYSRQ_ENABLE_RTNICE 0x0100struct sysrq_key_op { -void (*const handler)(int ); +void (*const handler)(u8 );const char *const help_msg;const char *const action_msg;const int enable_mask;kernel/debug/debug_core.c +1
-1@@ -968,7 +968,7 @@ static int __init opt_kgdb_con(char *str)early_param ("kgdbcon" , opt_kgdb_con);#ifdef CONFIG_MAGIC_SYSRQ -static void sysrq_handle_dbg (int key) +static void sysrq_handle_dbg (u8 key) {if (!dbg_io_ops) {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) static DECLARE_WORK(poweroff_work, do_poweroff); -static void handle_poweroff (int key) +static void handle_poweroff (u8 key) {/* run sysrq poweroff on boot cpu */ 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;module_param (sysrq_rcu, bool,0444 );/* Dump grace-period-request information due to commandeered sysrq. */ -static void sysrq_show_rcu (int key) +static void sysrq_show_rcu (u8 key) {show_rcu_gp_kthreads (); }Signature · 1 line
2.41.0
Re: [PATCH 02/10] tty: sysrq: switch sysrq handlers from int to u8
In reply to Jiri Slaby (SUSE)Quoted 10 lines · Jiri Slaby (SUSE)
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.))
Quoted 5 lines
Signed-off-by Jiri Slaby (SUSE) <[email protected]><snip>
Cc: Jason Wessel <[email protected]>
Cc: Daniel Thompson <[email protected]>
Cc: Douglas Anderson <[email protected]>
For kgdb:
Re: [PATCH 02/10] tty: sysrq: switch sysrq handlers from int to u8
In reply to Jiri Slaby (SUSE)Quoted 62 lines · Jiri Slaby (SUSE)
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) <[email protected]>Cc Richard Henderson <[email protected]>Cc Ivan Kokshaysky <[email protected]>Cc Matt Turner <[email protected]>Cc Huacai Chen <[email protected]>Cc WANG Xuerui <[email protected]>Cc Thomas Bogendoerfer <[email protected]>Cc Michael Ellerman <[email protected]>Cc Nicholas Piggin <[email protected]>Cc Christophe Leroy <[email protected]>Cc "David S. Miller" <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc Thomas Zimmermann <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Cc Jason Wessel <[email protected]>Cc Daniel Thompson <[email protected]>Cc Douglas Anderson <[email protected]>Cc "Rafael J. Wysocki" <[email protected]>Cc Len Brown <[email protected]>Cc Pavel Machek <[email protected]>Cc "Paul E. McKenney" <[email protected]>Cc Frederic Weisbecker <[email protected]>Cc Neeraj Upadhyay <[email protected]>Cc Joel Fernandes <[email protected]>Cc Josh Triplett <[email protected]>Cc Boqun Feng <[email protected]>Cc Steven Rostedt <[email protected]>Cc Mathieu Desnoyers <[email protected]>Cc Lai Jiangshan <[email protected]>Cc Zqiang <[email protected]>--- arch/alpha/kernel/setup.c | 2 +- arch/loongarch/kernel/sysrq.c | 2 +- arch/mips/kernel/sysrq.c | 2 +- arch/powerpc/xmon/xmon.c | 2 +- arch/sparc/kernel/process_64.c | 4 ++-- drivers/gpu/drm/drm_fb_helper.c | 2 +- drivers/tty/sysrq.c | 40 ++++++++++++++++----------------- include/linux/sysrq.h | 2 +- kernel/debug/debug_core.c | 2 +- kernel/power/poweroff.c | 2 +- kernel/rcu/tree_stall.h | 2 +- 11 files changed, 31 insertions(+), 31 deletions(-)[snip]
arch/loongarch/kernel/sysrq.c +0
-0
arch/loongarch/kernel/sysrq.c static void sysrq_tlbdump_othercpus(struct work_struct *dummy) · line 49
Quoted 9 lines
arch/loongarch/kernel/sysrq.c +1
-1@@ -43,7 +43,7 @@ static void sysrq_tlbdump_othercpus(struct work_struct *dummy) static DECLARE_WORK(sysrq_tlbdump, sysrq_tlbdump_othercpus);#endif -static void sysrq_handle_tlbdump (int key) +static void sysrq_handle_tlbdump (u8 key) {sysrq_tlbdump_single (NULL );#ifdef CONFIG_SMP
Thanks!
Signature · 3 lines
WANG "xen0n" Xuerui Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/
Jiri Slaby (SUSE)
maintainerPATCH 3/10 tty: sysrq: switch the rest of keys to u8
In reply to Jiri Slaby (SUSE)Propagate u8 more from the bottom to the interface, so that sysrq callers (usually drivers) see that u8 is expected.
--- drivers/tty/sysrq.c | 16 ++++++++-------- include/linux/sysrq.h | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-)
drivers/tty/sysrq.c +8 -8
@@ -530,7 +530,7 @@ static const struct sysrq_key_op *sysrq_key_table[62] = { };/* key2index calculation, -1 on invalid index */ -static int sysrq_key_table_key2index (int key) +static int sysrq_key_table_key2index (u8 key) {int retval;
@@ -548,7 +548,7 @@ static int sysrq_key_table_key2index(int key)/* * get and put functions for the table, exposed to modules. */ -static const struct sysrq_key_op *__sysrq_get_key_op (int key) +static const struct sysrq_key_op *__sysrq_get_key_op (u8 key) {const struct sysrq_key_op *op_p =NULL ;int i;
@@ -560,7 +560,7 @@ static const struct sysrq_key_op *__sysrq_get_key_op(int key)return op_p; } -static void __sysrq_put_key_op (int key,const struct sysrq_key_op *op_p) +static void __sysrq_put_key_op (u8 key,const struct sysrq_key_op *op_p) {int i =sysrq_key_table_key2index (key);
@@ -568,7 +568,7 @@ static void __sysrq_put_key_op(int key, const struct sysrq_key_op *op_p) sysrq_key_table[i] = op_p; } -void __handle_sysrq (int key,bool check_mask) +void __handle_sysrq (u8 key,bool check_mask) {const struct sysrq_key_op *op_p;int orig_log_level;
@@ -627,7 +627,7 @@ void __handle_sysrq(int key, bool check_mask) suppress_printk = orig_suppress_printk; } -void handle_sysrq (int key) +void handle_sysrq (u8 key) {if (sysrq_on ())__handle_sysrq (key, true);
@@ -1111,7 +1111,7 @@ int sysrq_toggle_support(int enable_mask) }EXPORT_SYMBOL_GPL (sysrq_toggle_support); -static int __sysrq_swap_key_ops (int key,const struct sysrq_key_op *insert_op_p, +static int __sysrq_swap_key_ops (u8 key,const struct sysrq_key_op *insert_op_p,const struct sysrq_key_op *remove_op_p) {int retval;
@@ -1135,13 +1135,13 @@ static int __sysrq_swap_key_ops(int key, const struct sysrq_key_op *insert_op_p,return retval; } -int register_sysrq_key (int key,const struct sysrq_key_op *op_p) +int register_sysrq_key (u8 key,const struct sysrq_key_op *op_p) {return __sysrq_swap_key_ops (key, op_p,NULL ); }EXPORT_SYMBOL (register_sysrq_key); -int unregister_sysrq_key (int key,const struct sysrq_key_op *op_p) +int unregister_sysrq_key (u8 key,const struct sysrq_key_op *op_p) {return __sysrq_swap_key_ops (key,NULL , op_p); }
include/linux/sysrq.h +8 -8
@@ -43,10 +43,10 @@ struct sysrq_key_op {* are available -- else NULL's). */ -void handle_sysrq (int key); -void __handle_sysrq (int key,bool check_mask); -int register_sysrq_key (int key,const struct sysrq_key_op *op); -int unregister_sysrq_key (int key,const struct sysrq_key_op *op); +void handle_sysrq (u8 key); +void __handle_sysrq (u8 key,bool check_mask); +int register_sysrq_key (u8 key,const struct sysrq_key_op *op); +int unregister_sysrq_key (u8 key,const struct sysrq_key_op *op);extern const struct sysrq_key_op *__sysrq_reboot_op;int sysrq_toggle_support (int enable_mask);
@@ -54,20 +54,20 @@ int sysrq_mask(void);#else -static inline void handle_sysrq (int key) +static inline void handle_sysrq (u8 key) { } -static inline void __handle_sysrq (int key,bool check_mask) +static inline void __handle_sysrq (u8 key,bool check_mask) { } -static inline int register_sysrq_key (int key,const struct sysrq_key_op *op) +static inline int register_sysrq_key (u8 key,const struct sysrq_key_op *op) {return -EINVAL ; } -static inline int unregister_sysrq_key (int key,const struct sysrq_key_op *op) +static inline int unregister_sysrq_key (u8 key,const struct sysrq_key_op *op) {return -EINVAL ; }
Signature · 1 line
2.41.0
Jiri Slaby (SUSE)
maintainerPATCH 4/10 tty: sysrq: use switch in sysrq_key_table_key2index()
In reply to Jiri Slaby (SUSE)Using switch with range cases makes the code more aligned and readable. Expand also that 36 as explicit addition of 10 + 26 to make the source of the constant more obvious.
--- drivers/tty/sysrq.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-)
drivers/tty/sysrq.c +10 -11
@@ -532,17 +532,16 @@ static const struct sysrq_key_op *sysrq_key_table[62] = {/* key2index calculation, -1 on invalid index */ static int sysrq_key_table_key2index (u8 key) { -int retval; - -if ((key >='0' ) && (key <='9' )) - retval = key -'0' ; -else if ((key >='a' ) && (key <='z' )) - retval = key +10 -'a' ; -else if ((key >='A' ) && (key <='Z' )) - retval = key +36 -'A' ; -else - retval =-1 ; -return retval; +switch (key) { + case '0' ... '9': +return key -'0' ; + case 'a' ... 'z': +return key -'a' +10 ; + case 'A' ... 'Z': +return key -'A' +10 +26 ; +default : +return -1 ; + } }/*
Signature · 1 line
2.41.0
Jiri Slaby (SUSE)
maintainerPATCH 5/10 serial: convert uart sysrq handling to u8
In reply to Jiri Slaby (SUSE)Propagate u8 from the sysrq code further up to serial's uart_handle_sysrq_char() and friends.
--- drivers/tty/serial/serial_core.c | 4 ++-- include/linux/serial_core.h | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-)
drivers/tty/serial/serial_core.c +2 -2
@@ -3505,7 +3505,7 @@ void uart_insert_char(struct uart_port *port, unsigned int status,EXPORT_SYMBOL_GPL (uart_insert_char);#ifdef CONFIG_MAGIC_SYSRQ_SERIAL -static const char sysrq_toggle_seq[] =CONFIG_MAGIC_SYSRQ_SERIAL_SEQUENCE ; +static const u8 sysrq_toggle_seq[] =CONFIG_MAGIC_SYSRQ_SERIAL_SEQUENCE ;static void uart_sysrq_on (struct work_struct *w) {
@@ -3528,7 +3528,7 @@ static DECLARE_WORK(sysrq_enable_work, uart_sysrq_on);* Returns: %false if @ch is out of enabling sequence and should be * handled some other way, %true if @ch was consumed. */ -bool uart_try_toggle_sysrq (struct uart_port *port,unsigned int ch) +bool uart_try_toggle_sysrq (struct uart_port *port,u8 ch) {int sysrq_toggle_seq_len =strlen (sysrq_toggle_seq);
include/linux/serial_core.h +8 -8
@@ -569,7 +569,7 @@ struct uart_port {struct serial_port_device *port_dev;/* serial core port device */ unsigned long sysrq;/* sysrq timeout */ -unsigned int sysrq_ch;/* char for sysrq */ +u8 sysrq_ch;/* char for sysrq */ unsigned char has_sysrq;unsigned char sysrq_seq;/* index in sysrq_toggle_seq */
@@ -910,9 +910,9 @@ void uart_xchar_out(struct uart_port *uport, int offset);#ifdef CONFIG_MAGIC_SYSRQ_SERIAL #define SYSRQ_TIMEOUT (HZ * 5) -bool uart_try_toggle_sysrq (struct uart_port *port,unsigned int ch); +bool uart_try_toggle_sysrq (struct uart_port *port,u8 ch); -static inline int uart_handle_sysrq_char (struct uart_port *port,unsigned int ch) +static inline int uart_handle_sysrq_char (struct uart_port *port,u8 ch) {if (!port->sysrq)return 0 ;
@@ -931,7 +931,7 @@ static inline int uart_handle_sysrq_char(struct uart_port *port, unsigned int chreturn 0 ; } -static inline int uart_prepare_sysrq_char (struct uart_port *port,unsigned int ch) +static inline int uart_prepare_sysrq_char (struct uart_port *port,u8 ch) {if (!port->sysrq)return 0 ;
@@ -952,7 +952,7 @@ static inline int uart_prepare_sysrq_char(struct uart_port *port, unsigned int cstatic inline void uart_unlock_and_check_sysrq (struct uart_port *port) { -int sysrq_ch; +u8 sysrq_ch;if (!port->has_sysrq) {spin_unlock (&port->lock);
@@ -971,7 +971,7 @@ static inline void uart_unlock_and_check_sysrq(struct uart_port *port)static inline void uart_unlock_and_check_sysrq_irqrestore (struct uart_port *port,unsigned long flags) { -int sysrq_ch; +u8 sysrq_ch;if (!port->has_sysrq) {spin_unlock_irqrestore (&port->lock, flags);
@@ -987,11 +987,11 @@ static inline void uart_unlock_and_check_sysrq_irqrestore(struct uart_port *port handle_sysrq(sysrq_ch); }#else /* CONFIG_MAGIC_SYSRQ_SERIAL */ -static inline int uart_handle_sysrq_char (struct uart_port *port,unsigned int ch) +static inline int uart_handle_sysrq_char (struct uart_port *port,u8 ch) {return 0 ; } -static inline int uart_prepare_sysrq_char (struct uart_port *port,unsigned int ch) +static inline int uart_prepare_sysrq_char (struct uart_port *port,u8 ch) {return 0 ; }
Signature · 1 line
2.41.0
Jiri Slaby (SUSE)
maintainerPATCH 6/10 serial: make uart_insert_char() accept u8s
In reply to Jiri Slaby (SUSE)Both the character and flag are 8-bit values. So switch from unsigned ints to u8s. The drivers will be cleaned up in the next round.
--- drivers/tty/serial/serial_core.c | 2 +- include/linux/serial_core.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/serial_core.c +1 -1
@@ -3486,7 +3486,7 @@ EXPORT_SYMBOL_GPL(uart_handle_cts_change);* @flag: flag for the character (see TTY_NORMAL and friends) */ void uart_insert_char (struct uart_port *port,unsigned int status, -unsigned int overrun,unsigned int ch,unsigned int flag) +unsigned int overrun,u8 ch,u8 flag) {struct tty_port *tport = &port->state->port;
include/linux/serial_core.h +1 -1
@@ -903,7 +903,7 @@ void uart_handle_dcd_change(struct uart_port *uport, bool active);void uart_handle_cts_change (struct uart_port *uport,bool active);void uart_insert_char (struct uart_port *port,unsigned int status, -unsigned int overrun,unsigned int ch,unsigned int flag); +unsigned int overrun,u8 ch,u8 flag);void uart_xchar_out (struct uart_port *uport,int offset);
Signature · 1 line
2.41.0
Jiri Slaby (SUSE)
maintainerPATCH 7/10 serial: pass state to __uart_start() directly
In reply to Jiri Slaby (SUSE)__uart_start() does not need a tty struct. It works only with uart_state. So pass the latter directly.
--- drivers/tty/serial/serial_core.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/tty/serial/serial_core.c +4 -5
@@ -133,9 +133,8 @@ static void uart_stop(struct tty_struct *tty)uart_port_unlock (port, flags); } -static void __uart_start (struct tty_struct *tty) +static void __uart_start (struct uart_state *state) { -struct uart_state *state = tty->driver_data;struct uart_port *port = state->uart_port;struct serial_port_device *port_dev;int err;
@@ -170,7 +169,7 @@ static void uart_start(struct tty_struct *tty)unsigned long flags; port =uart_port_lock (state, flags); -__uart_start (tty); +__uart_start (state);uart_port_unlock (port, flags); }
@@ -239,7 +238,7 @@ static void uart_change_line_settings(struct tty_struct *tty, struct uart_stateif (!old_hw_stopped) uport->ops->stop_tx (uport);else -__uart_start (tty); +__uart_start (state); }spin_unlock_irq (&uport->lock); }
@@ -619,7 +618,7 @@ static int uart_write(struct tty_struct *tty, ret += c; } -__uart_start (tty); +__uart_start (state);uart_port_unlock (port, flags);return ret; }
Signature · 1 line
2.41.0
Jiri Slaby (SUSE)
maintainerPATCH 8/10 serial: arc_uart: simplify flags handling in arc_serial_rx_chars()
In reply to Jiri Slaby (SUSE)* move the declaration of flg (with the initializer) to the loop, so there is no need to reset it to TTY_NORMAL by an 'else' branch.
* use TTY_NORMAL as initializer above, not a magic zero constant
* remove the outer 'if' from this construct:
if (S & (A | B)) {
if (S & A)
X;
if (S & B)
Y; }
* drop unlikely() as I doubt it has any benefits here. If it does, provide numbers.
All four make the code easier to read.
--- drivers/tty/serial/arc_uart.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-)
drivers/tty/serial/arc_uart.c +13 -16
@@ -195,8 +195,6 @@ static void arc_serial_start_tx(struct uart_port *port)static void arc_serial_rx_chars (struct uart_port *port,unsigned int status) { -unsigned int ch, flg =0 ; -/* * UART has 4 deep RX-FIFO. Driver's recongnition of this fact * is very subtle. Here's how ...
@@ -207,24 +205,23 @@ static void arc_serial_rx_chars(struct uart_port *port, unsigned int status)* controller, which is indeed the Rx-FIFO. */ do { + unsigned int ch, flg = TTY_NORMAL; + /* * This could be an Rx Intr for err (no data), * so check err and clear that Intr first */ - if (unlikely(status & (RXOERR | RXFERR))) { - if (status & RXOERR) { - port->icount.overrun++; - flg = TTY_OVERRUN; - UART_CLR_STATUS(port, RXOERR); - } - - if (status & RXFERR) { - port->icount.frame++; - flg = TTY_FRAME; - UART_CLR_STATUS(port, RXFERR); - } - } else - flg = TTY_NORMAL; + if (status & RXOERR) { + port->icount.overrun++; + flg = TTY_OVERRUN; + UART_CLR_STATUS(port, RXOERR); + } + + if (status & RXFERR) { + port->icount.frame++; + flg = TTY_FRAME; + UART_CLR_STATUS(port, RXFERR); + } if (status & RXEMPTY) continue;
Signature · 1 line
2.41.0
Re: [PATCH 08/10] serial: arc_uart: simplify flags handling in arc_serial_rx_chars()
Quoted 10 lines · Jiri Slaby (SUSE)
* move the declaration of flg (with the initializer) to the loop, so there is no need to reset it to
TTY_NORMALby an 'else' branch.
* useTTY_NORMALas initializer above, not a magic zero constant
* remove the outer 'if' from this construct:if (S & (A | B)) { if (S & A) X; if (S & B) Y; }
Quoted 7 lines
* drop
unlikely()as I doubt it has any benefits here. If it does, provide numbers.All four make the code easier to read.
Signed-off-by Jiri Slaby (SUSE)<[email protected]>Cc Vineet Gupta<[email protected]>
Thanks for the cleanup.
Th,
-Vineet
Jiri Slaby (SUSE)
maintainerPATCH 9/10 serial: omap-serial: remove flag from serial_omap_rdi()
In reply to Jiri Slaby (SUSE)The local 'flag' variable carries only TTY_NORMAL. So use that constant directly and drop the variable.
--- drivers/tty/serial/omap-serial.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/tty/serial/omap-serial.c +1 -3
@@ -499,7 +499,6 @@ static void serial_omap_rlsi(struct uart_omap_port *up, unsigned int lsr)static void serial_omap_rdi (struct uart_omap_port *up,unsigned int lsr) {unsigned char ch =0 ; -unsigned int flag;if (!(lsr &UART_LSR_DR ))return ;
@@ -512,13 +511,12 @@ static void serial_omap_rdi(struct uart_omap_port *up, unsigned int lsr)return ; } - flag =TTY_NORMAL ; up->port.icount.rx++;if (uart_handle_sysrq_char (&up->port, ch))return ; -uart_insert_char (&up->port, lsr,UART_LSR_OE , ch, flag); +uart_insert_char (&up->port, lsr,UART_LSR_OE , ch,TTY_NORMAL ); }/**
Signature · 1 line
2.41.0
Jiri Slaby (SUSE)
maintainerPATCH 10/10 serial: drivers: switch ch and flag to u8
In reply to Jiri Slaby (SUSE)Now that the serial layer explicitly expects 'u8' for flags and characters, propagate this type to drivers' (RX) routines.
Note that amba-pl011's, clps711x's and st-asc's 'ch' are left unchanged because 'ch' contains not only a character, but whole status.
--- drivers/tty/serial/21285.c | 3 ++- drivers/tty/serial/8250/8250_port.c | 3 +-- drivers/tty/serial/altera_jtaguart.c | 2 +- drivers/tty/serial/altera_uart.c | 2 +- drivers/tty/serial/amba-pl010.c | 3 ++- drivers/tty/serial/amba-pl011.c | 3 ++- drivers/tty/serial/apbuart.c | 3 ++- drivers/tty/serial/arc_uart.c | 2 +- drivers/tty/serial/atmel_serial.c | 2 +- drivers/tty/serial/clps711x.c | 3 ++- drivers/tty/serial/digicolor-usart.c | 3 +-- drivers/tty/serial/dz.c | 2 +- drivers/tty/serial/ip22zilog.c | 2 +- drivers/tty/serial/max3100.c | 3 ++- drivers/tty/serial/max310x.c | 3 ++- drivers/tty/serial/mcf.c | 2 +- drivers/tty/serial/milbeaut_usio.c | 3 +-- drivers/tty/serial/mxs-auart.c | 3 +-- drivers/tty/serial/omap-serial.c | 4 ++-- drivers/tty/serial/pxa.c | 2 +- drivers/tty/serial/rp2.c | 4 ++-- drivers/tty/serial/sa1100.c | 3 ++- drivers/tty/serial/samsung_tty.c | 3 ++- drivers/tty/serial/sb1250-duart.c | 3 ++- drivers/tty/serial/sc16is7xx.c | 3 ++- drivers/tty/serial/sccnxp.c | 3 +-- drivers/tty/serial/serial-tegra.c | 7 +++---- drivers/tty/serial/serial_txx9.c | 3 +-- drivers/tty/serial/sifive.c | 2 +- drivers/tty/serial/sprd_serial.c | 5 +++-- drivers/tty/serial/st-asc.c | 2 +- drivers/tty/serial/stm32-usart.c | 5 ++--- drivers/tty/serial/sunplus-uart.c | 2 +- drivers/tty/serial/zs.c | 3 ++- 34 files changed, 53 insertions(+), 48 deletions(-)
drivers/tty/serial/21285.c +2 -1
@@ -117,7 +117,8 @@ static void serial21285_stop_rx(struct uart_port *port)static irqreturn_t serial21285_rx_chars (int irq,void *dev_id) {struct uart_port *port = dev_id; -unsigned int status, ch, flag, rxs, max_count =256 ; +unsigned int status, rxs, max_count =256 ; +u8 ch, flag; status = *CSR_UARTFLG ;while (!(status &0x10 ) && max_count--) {
drivers/tty/serial/8250/8250_port.c +1 -2
@@ -1706,8 +1706,7 @@ static void serial8250_enable_ms(struct uart_port *port)void serial8250_read_char (struct uart_8250_port *up,u16 lsr) {struct uart_port *port = &up->port; -unsigned char ch; -char flag =TTY_NORMAL ; +u8 ch, flag =TTY_NORMAL ;if (likely (lsr &UART_LSR_DR )) ch =serial_in (up,UART_RX );
drivers/tty/serial/altera_jtaguart.c +1 -1
@@ -110,8 +110,8 @@ static void altera_jtaguart_set_termios(struct uart_port *port,static void altera_jtaguart_rx_chars (struct uart_port *port) { -unsigned char ch;unsigned long status; +u8 ch;while ((status =readl (port->membase +ALTERA_JTAGUART_DATA_REG )) &ALTERA_JTAGUART_DATA_RVALID_MSK ) {
drivers/tty/serial/altera_uart.c +1 -1
@@ -201,8 +201,8 @@ static void altera_uart_set_termios(struct uart_port *port,static void altera_uart_rx_chars (struct uart_port *port) { -unsigned char ch, flag;unsigned short status; +u8 ch, flag;while ((status =altera_uart_readl (port,ALTERA_UART_STATUS_REG )) &ALTERA_UART_STATUS_RRDY_MSK ) {
drivers/tty/serial/amba-pl010.c +2 -1
@@ -112,7 +112,8 @@ static void pl010_enable_ms(struct uart_port *port)static void pl010_rx_chars (struct uart_port *port) { -unsigned int status, ch, flag, rsr, max_count =256 ; +unsigned int status, rsr, max_count =256 ; +u8 ch, flag; status =readb (port->membase + UART01x_FR);while (UART_RX_DATA (status) && max_count--) {
drivers/tty/serial/amba-pl011.c +2 -1
@@ -307,9 +307,10 @@ static void pl011_write(unsigned int val, const struct uart_amba_port *uap,*/ static int pl011_fifo_to_tty (struct uart_amba_port *uap) { -unsigned int ch, flag, fifotaken; +unsigned int ch, fifotaken;int sysrq;u16 status; +u8 flag;for (fifotaken =0 ; fifotaken !=256 ; fifotaken++) { status =pl011_read (uap,REG_FR );
drivers/tty/serial/apbuart.c +2 -1
@@ -70,8 +70,9 @@ static void apbuart_stop_rx(struct uart_port *port)static void apbuart_rx_chars (struct uart_port *port) { -unsigned int status, ch, rsr, flag; +unsigned int status, rsr;unsigned int max_chars = port->fifosize; +u8 ch, flag; status =UART_GET_STATUS (port);
drivers/tty/serial/arc_uart.c +1 -1
@@ -205,7 +205,7 @@ static void arc_serial_rx_chars(struct uart_port *port, unsigned int status)* controller, which is indeed the Rx-FIFO. */ do { - unsigned int ch, flg = TTY_NORMAL; + u8 ch, flg = TTY_NORMAL; /* * This could be an Rx Intr for err (no data),
drivers/tty/serial/atmel_serial.c +1 -1
@@ -1516,8 +1516,8 @@ static void atmel_rx_from_ring(struct uart_port *port) {struct atmel_uart_port *atmel_port =to_atmel_uart_port (port);struct circ_buf *ring = &atmel_port->rx_ring; -unsigned int flg;unsigned int status; +u8 flg;while (ring->head != ring->tail) {struct atmel_uart_char c;
drivers/tty/serial/clps711x.c +2 -1
@@ -92,8 +92,9 @@ static irqreturn_t uart_clps711x_int_rx(int irq, void *dev_id) {struct uart_port *port = dev_id;struct clps711x_port *s =dev_get_drvdata (port->dev); -unsigned int status, flg; +unsigned int status;u16 ch; +u8 flg;for (;;) {u32 sysflg =0 ;
drivers/tty/serial/digicolor-usart.c +1 -2
@@ -136,8 +136,7 @@ static void digicolor_uart_rx(struct uart_port *port)spin_lock_irqsave (&port->lock, flags);while (1 ) { -u8 status, ch; -unsigned int ch_flag; +u8 status, ch, ch_flag;if (digicolor_uart_rx_empty (port))break ;
drivers/tty/serial/dz.c +1 -1
@@ -181,8 +181,8 @@ static inline void dz_receive_chars(struct dz_mux *mux)struct dz_port *dport = &mux->dport[0 ];struct uart_icount *icount;int lines_rx[DZ_NB_PORT ] = { [0 ...DZ_NB_PORT -1 ] =0 }; -unsigned char ch, flag;u16 status; +u8 ch, flag;int i;while ((status =dz_in (dport,DZ_RBUF )) &DZ_DVAL ) {
drivers/tty/serial/ip22zilog.c +1 -1
@@ -248,8 +248,8 @@ static void ip22zilog_maybe_update_regs(struct uart_ip22zilog_port *up,static bool ip22zilog_receive_chars (struct uart_ip22zilog_port *up,struct zilog_channel *channel) { -unsigned char ch, flag;unsigned int r1; +u8 ch, flag;bool push = up->port.state !=NULL ;for (;;) {
drivers/tty/serial/max3100.c +2 -1
@@ -215,8 +215,9 @@ static int max3100_sr(struct max3100_port *s, u16 tx, u16 *rx)static int max3100_handlerx (struct max3100_port *s,u16 rx) { -unsigned int ch, flg, status =0 ; +unsigned int status =0 ;int ret =0 , cts; +u8 ch, flg;if (rx &MAX3100_R && s->rx_enabled) {dev_dbg (&s->spi->dev,"%s\n" , __func__);
drivers/tty/serial/max310x.c +2 -1
@@ -669,7 +669,8 @@ static void max310x_batch_read(struct uart_port *port, u8 *rxbuf, unsigned int lstatic void max310x_handle_rx (struct uart_port *port,unsigned int rxlen) {struct max310x_one *one =to_max310x_port (port); -unsigned int sts, ch, flag, i; +unsigned int sts, i; +u8 ch, flag;if (port->read_status_mask ==MAX310X_LSR_RXOVR_BIT ) {/* We are just reading, happily ignoring any error conditions.
drivers/tty/serial/mcf.c +1 -1
@@ -281,7 +281,7 @@ static void mcf_set_termios(struct uart_port *port, struct ktermios *termios,static void mcf_rx_chars (struct mcf_uart *pp) {struct uart_port *port = &pp->port; -unsigned char status, ch, flag; +u8 status, ch, flag;while ((status =readb (port->membase +MCFUART_USR )) &MCFUART_USR_RXREADY ) { ch =readb (port->membase +MCFUART_URB );
drivers/tty/serial/milbeaut_usio.c +1 -2
@@ -148,8 +148,7 @@ static void mlb_usio_enable_ms(struct uart_port *port)static void mlb_usio_rx_chars (struct uart_port *port) {struct tty_port *ttyport = &port->state->port; -unsigned long flag =0 ; -char ch =0 ; +u8 flag =0 , ch =0 ;u8 status;int max_count =2 ;
drivers/tty/serial/mxs-auart.c +1 -2
@@ -616,9 +616,8 @@ static void mxs_auart_tx_chars(struct mxs_auart_port *s)static void mxs_auart_rx_char (struct mxs_auart_port *s) { -int flag;u32 stat; -u8 c; +u8 c, flag; c =mxs_read (s,REG_DATA ); stat =mxs_read (s,REG_STAT );
drivers/tty/serial/omap-serial.c +2 -2
@@ -442,7 +442,7 @@ static unsigned int check_modem_status(struct uart_omap_port *up)static void serial_omap_rlsi (struct uart_omap_port *up,unsigned int lsr) { -unsigned int flag; +u8 flag;/* * Read one data character out to avoid stalling the receiver according
@@ -498,7 +498,7 @@ static void serial_omap_rlsi(struct uart_omap_port *up, unsigned int lsr)static void serial_omap_rdi (struct uart_omap_port *up,unsigned int lsr) { -unsigned char ch =0 ; +u8 ch;if (!(lsr &UART_LSR_DR ))return ;
drivers/tty/serial/pxa.c +1 -1
@@ -90,7 +90,7 @@ static void serial_pxa_stop_rx(struct uart_port *port)static inline void receive_chars (struct uart_pxa_port *up,int *status) { -unsigned int ch, flag; +u8 ch, flag;int max_count =256 ; do {
drivers/tty/serial/rp2.c +2 -2
@@ -401,14 +401,14 @@ static void rp2_rx_chars(struct rp2_uart_port *up)for (; bytes !=0 ; bytes--) {u32 byte =readw (up->base +RP2_DATA_BYTE ) |RP2_DUMMY_READ ; -char ch = byte &0xff ; +u8 ch = byte &0xff ;if (likely (!(byte &RP2_DATA_BYTE_EXCEPTION_MASK ))) {if (!uart_handle_sysrq_char (&up->port, ch))uart_insert_char (&up->port, byte,0 , ch,TTY_NORMAL ); }else { -char flag =TTY_NORMAL ; +u8 flag =TTY_NORMAL ;if (byte & RP2_DATA_BYTE_BREAK_m) flag =TTY_BREAK ;
drivers/tty/serial/sa1100.c +2 -1
@@ -180,7 +180,8 @@ static void sa1100_enable_ms(struct uart_port *port)static void sa1100_rx_chars (struct sa1100_port *sport) { -unsigned int status, ch, flg; +unsigned int status; +u8 ch, flg; status =UTSR1_TO_SM (UART_GET_UTSR1 (sport)) |UTSR0_TO_SM (UART_GET_UTSR0 (sport));
drivers/tty/serial/samsung_tty.c +2 -1
@@ -759,9 +759,10 @@ static irqreturn_t s3c24xx_serial_rx_chars_dma(void *dev_id)static void s3c24xx_serial_rx_drain_fifo (struct s3c24xx_uart_port *ourport) {struct uart_port *port = &ourport->port; -unsigned int ufcon, ch, flag, ufstat, uerstat; +unsigned int ufcon, ufstat, uerstat;unsigned int fifocnt =0 ;int max_count = port->fifosize; +u8 ch, flag;while (max_count-- >0 ) {/*
drivers/tty/serial/sb1250-duart.c +2 -1
@@ -331,8 +331,9 @@ static void sbd_receive_chars(struct sbd_port *sport) {struct uart_port *uport = &sport->port;struct uart_icount *icount; -unsigned int status, ch, flag; +unsigned int status;int count; +u8 ch, flag;for (count =16 ; count; count--) { status =read_sbdchn (sport,R_DUART_STATUS );
drivers/tty/serial/sc16is7xx.c +2 -1
@@ -578,8 +578,9 @@ static void sc16is7xx_handle_rx(struct uart_port *port, unsigned int rxlen, unsigned int iir) {struct sc16is7xx_port *s =dev_get_drvdata (port->dev); -unsigned int lsr =0 , ch, flag, bytes_read, i; +unsigned int lsr =0 , bytes_read, i;bool read_lsr = (iir ==SC16IS7XX_IIR_RLSE_SRC ) ? true : false; +u8 ch, flag;if (unlikely (rxlen >=sizeof (s->buf))) { dev_warn_ratelimited(port->dev,
drivers/tty/serial/sccnxp.c +1 -2
@@ -383,8 +383,7 @@ static void sccnxp_set_bit(struct uart_port *port, int sig, int state)static void sccnxp_handle_rx (struct uart_port *port) { -u8 sr; -unsigned int ch, flag; +u8 sr, ch, flag;for (;;) { sr =sccnxp_port_read (port,SCCNXP_SR_REG );
drivers/tty/serial/serial-tegra.c +3 -4
@@ -434,10 +434,10 @@ static int tegra_set_baudrate(struct tegra_uart_port *tup, unsigned int baud)return 0 ; } -static char tegra_uart_decode_rx_error (struct tegra_uart_port *tup, +static u8 tegra_uart_decode_rx_error (struct tegra_uart_port *tup,unsigned long lsr) { -char flag =TTY_NORMAL ; +u8 flag =TTY_NORMAL ;if (unlikely (lsr &TEGRA_UART_LSR_ANY )) {if (lsr &UART_LSR_OE ) {
@@ -642,9 +642,8 @@ static void tegra_uart_handle_rx_pio(struct tegra_uart_port *tup, struct tty_port *port) { do { - char flag = TTY_NORMAL; unsigned long lsr = 0; - unsigned char ch; + u8 ch, flag = TTY_NORMAL; lsr = tegra_uart_read(tup, UART_LSR); if (!(lsr & UART_LSR_DR))
drivers/tty/serial/serial_txx9.c +1 -2
@@ -246,11 +246,10 @@ static void serial_txx9_initialize(struct uart_port *up)static inline void receive_chars (struct uart_port *up,unsigned int *status) { -unsigned char ch;unsigned int disr = *status;int max_count =256 ; -char flag;unsigned int next_ignore_status_mask; +u8 ch, flag; do { ch = sio_in(up, TXX9_SIRFIFO);
drivers/tty/serial/sifive.c +1 -1
@@ -402,9 +402,9 @@ static char __ssp_receive_char(struct sifive_serial_port *ssp, char *is_empty)*/ static void __ssp_receive_chars (struct sifive_serial_port *ssp) { -unsigned char ch;char is_empty;int c; +u8 ch;for (c =SIFIVE_RX_FIFO_DEPTH ; c >0 ; --c) { ch =__ssp_receive_char (ssp, &is_empty);
drivers/tty/serial/sprd_serial.c +3 -2
@@ -558,7 +558,7 @@ static void sprd_break_ctl(struct uart_port *port, int break_state) }static int handle_lsr_errors (struct uart_port *port, -unsigned int *flag, +u8 *flag,unsigned int *lsr) {int ret =0 ;
@@ -594,7 +594,8 @@ static inline void sprd_rx(struct uart_port *port) struct sprd_uart_port *sp = container_of(port, struct sprd_uart_port, port);struct tty_port *tty = &port->state->port; -unsigned int ch, flag, lsr, max_count =SPRD_TIMEOUT ; +unsigned int lsr, max_count =SPRD_TIMEOUT ; +u8 ch, flag;if (sp->rx_dma.enable) {sprd_uart_dma_irq (port);
drivers/tty/serial/st-asc.c +1 -1
@@ -250,7 +250,7 @@ static void asc_receive_chars(struct uart_port *port)struct tty_port *tport = &port->state->port;unsigned long status, mode;unsigned long c =0 ; -char flag; +u8 flag;bool ignore_pe = false;/*
drivers/tty/serial/stm32-usart.c +2 -3
@@ -321,7 +321,7 @@ static bool stm32_usart_pending_rx_pio(struct uart_port *port, u32 *sr)return false; } -static unsigned long stm32_usart_get_char_pio (struct uart_port *port) +static u8 stm32_usart_get_char_pio (struct uart_port *port) {struct stm32_port *stm32_port =to_stm32_port (port);const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
@@ -338,10 +338,9 @@ static unsigned int stm32_usart_receive_chars_pio(struct uart_port *port) {struct stm32_port *stm32_port =to_stm32_port (port);const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; -unsigned long c;unsigned int size =0 ;u32 sr; -char flag; +u8 c, flag;while (stm32_usart_pending_rx_pio (port, &sr)) { sr |=USART_SR_DUMMY_RX ;
drivers/tty/serial/sunplus-uart.c +1 -1
@@ -231,7 +231,7 @@ static void transmit_chars(struct uart_port *port)static void receive_chars (struct uart_port *port) {unsigned int lsr =readl (port->membase +SUP_UART_LSR ); -unsigned int ch, flag; +u8 ch, flag; do { ch = readl(port->membase + SUP_UART_DATA);
drivers/tty/serial/zs.c +2 -1
@@ -539,8 +539,9 @@ static void zs_receive_chars(struct zs_port *zport)struct uart_port *uport = &zport->port;struct zs_scc *scc = zport->scc;struct uart_icount *icount; -unsigned int avail, status, ch, flag; +unsigned int avail, status;int count; +u8 ch, flag;for (count =16 ; count; count--) {spin_lock (&scc->zlock);
Signature · 1 line
2.41.0
Re: [PATCH 10/10] serial: drivers: switch ch and flag to u8
Quoted 3 lines · Jiri Slaby (SUSE)
drivers/tty/serial/dz.c | 2 +- drivers/tty/serial/sb1250-duart.c | 3 ++- drivers/tty/serial/zs.c | 3 ++-
For these:
Thanks for making this clean-up.
Maciej
Re: [PATCH 10/10] serial: drivers: switch ch and flag to u8
In reply to Jiri Slaby (SUSE)On Wed, Jul 12, 2023 at 10:18:11AM +0200, Jiri Slaby (SUSE) wrote:
[...]
Quoted 1 line
drivers/tty/serial/serial-tegra.c | 7 +++----
Re: [PATCH 10/10] serial: drivers: switch ch and flag to u8
In reply to Jiri Slaby (SUSE)On 2023-07-12 at 10:18:11 +0200, Jiri Slaby (SUSE) <[email protected]> wrote:
[...]
Quoted 2 lines
drivers/tty/serial/altera_jtaguart.c | 2 +- drivers/tty/serial/altera_uart.c | 2 +-
For these:
Re: [PATCH 10/10] serial: drivers: switch ch and flag to u8
In reply to Jiri Slaby (SUSE)Le 12/07/2023 à 10:18, Jiri Slaby (SUSE) a écrit :
Quoted 1 line
drivers/tty/serial/atmel_serial.c | 2 +-
Thanks !