* [PATCH 00/10] tty: u8 conversion preparation
@ 2023-07-12 8:18 Jiri Slaby (SUSE)
2023-07-12 8:18 ` [PATCH 01/10] tty: sysrq: rename and re-type i in sysrq_handle_loglevel() Jiri Slaby (SUSE)
` (9 more replies)
0 siblings, 10 replies; 20+ messages in thread
From: Jiri Slaby (SUSE) @ 2023-07-12 8:18 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE)
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(-)
--
2.41.0
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 01/10] tty: sysrq: rename and re-type i in sysrq_handle_loglevel()
2023-07-12 8:18 [PATCH 00/10] tty: u8 conversion preparation Jiri Slaby (SUSE)
@ 2023-07-12 8:18 ` Jiri Slaby (SUSE)
2023-07-12 8:18 ` [PATCH 02/10] tty: sysrq: switch sysrq handlers from int to u8 Jiri Slaby (SUSE)
` (8 subsequent siblings)
9 siblings, 0 replies; 20+ messages in thread
From: Jiri Slaby (SUSE) @ 2023-07-12 8:18 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE)
'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.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
---
drivers/tty/sysrq.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index e1df63a88aac..13465e4cca9b 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -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,
--
2.41.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 02/10] tty: sysrq: switch sysrq handlers from int to u8
2023-07-12 8:18 [PATCH 00/10] tty: u8 conversion preparation Jiri Slaby (SUSE)
2023-07-12 8:18 ` [PATCH 01/10] tty: sysrq: rename and re-type i in sysrq_handle_loglevel() Jiri Slaby (SUSE)
@ 2023-07-12 8:18 ` Jiri Slaby (SUSE)
2023-07-12 8:34 ` Thomas Zimmermann
` (3 more replies)
2023-07-12 8:18 ` [PATCH 03/10] tty: sysrq: switch the rest of keys " Jiri Slaby (SUSE)
` (7 subsequent siblings)
9 siblings, 4 replies; 20+ messages in thread
From: Jiri Slaby (SUSE) @ 2023-07-12 8:18 UTC (permalink / raw)
To: gregkh
Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE), Richard Henderson,
Ivan Kokshaysky, Matt Turner, Huacai Chen, WANG Xuerui,
Thomas Bogendoerfer, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, David S. Miller, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter,
Jason Wessel, Daniel Thompson, Douglas Anderson,
Rafael J. Wysocki, Len Brown, Pavel Machek, Paul E. McKenney,
Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
Josh Triplett, Boqun Feng, Steven Rostedt, Mathieu Desnoyers,
Lai Jiangshan, Zqiang
The passed parameter to sysrq handlers is a key (a character). So change
the type from 'int' to 'u8'. Let it specifically be 'u8' for two
reasons:
* unsigned: unsigned values come from the upper layers (devices) and the
tty layer assumes unsigned on most places, and
* 8-bit: as that what's supposed to be one day in all the layers built
on the top of tty. (Currently, we use mostly 'unsigned char' and
somewhere still only 'char'. (But that also translates to the former
thanks to -funsigned-char.))
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: WANG Xuerui <kernel@xen0n.name>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Len Brown <len.brown@intel.com>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Frederic Weisbecker <frederic@kernel.org>
Cc: Neeraj Upadhyay <quic_neeraju@quicinc.com>
Cc: Joel Fernandes <joel@joelfernandes.org>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: Zqiang <qiang.zhang1211@gmail.com>
---
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(-)
diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c
index b650ff1cb022..91fb3714ebc2 100644
--- a/arch/alpha/kernel/setup.c
+++ b/arch/alpha/kernel/setup.c
@@ -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();
}
diff --git a/arch/loongarch/kernel/sysrq.c b/arch/loongarch/kernel/sysrq.c
index 366baef72d29..e663c10fa39c 100644
--- a/arch/loongarch/kernel/sysrq.c
+++ b/arch/loongarch/kernel/sysrq.c
@@ -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
diff --git a/arch/mips/kernel/sysrq.c b/arch/mips/kernel/sysrq.c
index 9c1a2019113b..2e98049fe783 100644
--- a/arch/mips/kernel/sysrq.c
+++ b/arch/mips/kernel/sysrq.c
@@ -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
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index ee17270d35d0..3b6f524c790e 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -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();
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
index b51d8fb0ecdc..4dee88af403f 100644
--- a/arch/sparc/kernel/process_64.c
+++ b/arch/sparc/kernel/process_64.c
@@ -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();
}
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 61a5d450cc20..d612133e2cf7 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -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);
}
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index 13465e4cca9b..1271a82c0887 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -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();
}
diff --git a/include/linux/sysrq.h b/include/linux/sysrq.h
index 3a582ec7a2f1..bb8d07814b0e 100644
--- a/include/linux/sysrq.h
+++ b/include/linux/sysrq.h
@@ -30,7 +30,7 @@
#define SYSRQ_ENABLE_RTNICE 0x0100
struct 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;
diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c
index d5e9ccde3ab8..621037a0aa87 100644
--- a/kernel/debug/debug_core.c
+++ b/kernel/debug/debug_core.c
@@ -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");
diff --git a/kernel/power/poweroff.c b/kernel/power/poweroff.c
index 562aa0e450ed..1f306f158696 100644
--- a/kernel/power/poweroff.c
+++ b/kernel/power/poweroff.c
@@ -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);
diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h
index b10b8349bb2a..6f06dc12904a 100644
--- a/kernel/rcu/tree_stall.h
+++ b/kernel/rcu/tree_stall.h
@@ -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();
}
--
2.41.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 03/10] tty: sysrq: switch the rest of keys to u8
2023-07-12 8:18 [PATCH 00/10] tty: u8 conversion preparation Jiri Slaby (SUSE)
2023-07-12 8:18 ` [PATCH 01/10] tty: sysrq: rename and re-type i in sysrq_handle_loglevel() Jiri Slaby (SUSE)
2023-07-12 8:18 ` [PATCH 02/10] tty: sysrq: switch sysrq handlers from int to u8 Jiri Slaby (SUSE)
@ 2023-07-12 8:18 ` Jiri Slaby (SUSE)
2023-07-12 8:18 ` [PATCH 04/10] tty: sysrq: use switch in sysrq_key_table_key2index() Jiri Slaby (SUSE)
` (6 subsequent siblings)
9 siblings, 0 replies; 20+ messages in thread
From: Jiri Slaby (SUSE) @ 2023-07-12 8:18 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE)
Propagate u8 more from the bottom to the interface, so that sysrq
callers (usually drivers) see that u8 is expected.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
---
drivers/tty/sysrq.c | 16 ++++++++--------
include/linux/sysrq.h | 16 ++++++++--------
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index 1271a82c0887..ccf429ba348e 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -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);
}
diff --git a/include/linux/sysrq.h b/include/linux/sysrq.h
index bb8d07814b0e..bdca467ebb77 100644
--- a/include/linux/sysrq.h
+++ b/include/linux/sysrq.h
@@ -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;
}
--
2.41.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 04/10] tty: sysrq: use switch in sysrq_key_table_key2index()
2023-07-12 8:18 [PATCH 00/10] tty: u8 conversion preparation Jiri Slaby (SUSE)
` (2 preceding siblings ...)
2023-07-12 8:18 ` [PATCH 03/10] tty: sysrq: switch the rest of keys " Jiri Slaby (SUSE)
@ 2023-07-12 8:18 ` Jiri Slaby (SUSE)
2023-07-12 8:18 ` [PATCH 05/10] serial: convert uart sysrq handling to u8 Jiri Slaby (SUSE)
` (5 subsequent siblings)
9 siblings, 0 replies; 20+ messages in thread
From: Jiri Slaby (SUSE) @ 2023-07-12 8:18 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, 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.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
---
drivers/tty/sysrq.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index ccf429ba348e..23198e3f1461 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -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;
+ }
}
/*
--
2.41.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 05/10] serial: convert uart sysrq handling to u8
2023-07-12 8:18 [PATCH 00/10] tty: u8 conversion preparation Jiri Slaby (SUSE)
` (3 preceding siblings ...)
2023-07-12 8:18 ` [PATCH 04/10] tty: sysrq: use switch in sysrq_key_table_key2index() Jiri Slaby (SUSE)
@ 2023-07-12 8:18 ` Jiri Slaby (SUSE)
2023-07-12 8:18 ` [PATCH 06/10] serial: make uart_insert_char() accept u8s Jiri Slaby (SUSE)
` (4 subsequent siblings)
9 siblings, 0 replies; 20+ messages in thread
From: Jiri Slaby (SUSE) @ 2023-07-12 8:18 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE)
Propagate u8 from the sysrq code further up to serial's
uart_handle_sysrq_char() and friends.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
---
drivers/tty/serial/serial_core.c | 4 ++--
include/linux/serial_core.h | 16 ++++++++--------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 831d033611e6..7e37db9adbd4 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -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);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 6d58c57acdaa..14dd85ee849e 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -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 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)
{
if (!port->sysrq)
return 0;
@@ -952,7 +952,7 @@ static inline int uart_prepare_sysrq_char(struct uart_port *port, unsigned int c
static 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;
}
--
2.41.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 06/10] serial: make uart_insert_char() accept u8s
2023-07-12 8:18 [PATCH 00/10] tty: u8 conversion preparation Jiri Slaby (SUSE)
` (4 preceding siblings ...)
2023-07-12 8:18 ` [PATCH 05/10] serial: convert uart sysrq handling to u8 Jiri Slaby (SUSE)
@ 2023-07-12 8:18 ` Jiri Slaby (SUSE)
2023-07-12 8:18 ` [PATCH 07/10] serial: pass state to __uart_start() directly Jiri Slaby (SUSE)
` (3 subsequent siblings)
9 siblings, 0 replies; 20+ messages in thread
From: Jiri Slaby (SUSE) @ 2023-07-12 8:18 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, 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.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
---
drivers/tty/serial/serial_core.c | 2 +-
include/linux/serial_core.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 7e37db9adbd4..bef507cb804c 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -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;
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 14dd85ee849e..105d2cdc0126 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -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);
--
2.41.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 07/10] serial: pass state to __uart_start() directly
2023-07-12 8:18 [PATCH 00/10] tty: u8 conversion preparation Jiri Slaby (SUSE)
` (5 preceding siblings ...)
2023-07-12 8:18 ` [PATCH 06/10] serial: make uart_insert_char() accept u8s Jiri Slaby (SUSE)
@ 2023-07-12 8:18 ` Jiri Slaby (SUSE)
2023-07-12 8:18 ` [PATCH 08/10] serial: arc_uart: simplify flags handling in arc_serial_rx_chars() Jiri Slaby (SUSE)
` (2 subsequent siblings)
9 siblings, 0 replies; 20+ messages in thread
From: Jiri Slaby (SUSE) @ 2023-07-12 8:18 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE)
__uart_start() does not need a tty struct. It works only with
uart_state. So pass the latter directly.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
---
drivers/tty/serial/serial_core.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index bef507cb804c..306ea1a560e6 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -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_state
if (!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;
}
--
2.41.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 08/10] serial: arc_uart: simplify flags handling in arc_serial_rx_chars()
2023-07-12 8:18 [PATCH 00/10] tty: u8 conversion preparation Jiri Slaby (SUSE)
` (6 preceding siblings ...)
2023-07-12 8:18 ` [PATCH 07/10] serial: pass state to __uart_start() directly Jiri Slaby (SUSE)
@ 2023-07-12 8:18 ` Jiri Slaby (SUSE)
2023-07-13 0:58 ` Vineet Gupta
2023-07-12 8:18 ` [PATCH 09/10] serial: omap-serial: remove flag from serial_omap_rdi() Jiri Slaby (SUSE)
2023-07-12 8:18 ` [PATCH 10/10] serial: drivers: switch ch and flag to u8 Jiri Slaby (SUSE)
9 siblings, 1 reply; 20+ messages in thread
From: Jiri Slaby (SUSE) @ 2023-07-12 8:18 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE), Vineet Gupta
* 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.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Cc: Vineet Gupta <vgupta@kernel.org>
---
drivers/tty/serial/arc_uart.c | 29 +++++++++++++----------------
1 file changed, 13 insertions(+), 16 deletions(-)
diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c
index 4b2512eef577..835903488acb 100644
--- a/drivers/tty/serial/arc_uart.c
+++ b/drivers/tty/serial/arc_uart.c
@@ -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;
--
2.41.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 09/10] serial: omap-serial: remove flag from serial_omap_rdi()
2023-07-12 8:18 [PATCH 00/10] tty: u8 conversion preparation Jiri Slaby (SUSE)
` (7 preceding siblings ...)
2023-07-12 8:18 ` [PATCH 08/10] serial: arc_uart: simplify flags handling in arc_serial_rx_chars() Jiri Slaby (SUSE)
@ 2023-07-12 8:18 ` Jiri Slaby (SUSE)
2023-07-12 8:18 ` [PATCH 10/10] serial: drivers: switch ch and flag to u8 Jiri Slaby (SUSE)
9 siblings, 0 replies; 20+ messages in thread
From: Jiri Slaby (SUSE) @ 2023-07-12 8:18 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE)
The local 'flag' variable carries only TTY_NORMAL. So use that constant
directly and drop the variable.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
---
drivers/tty/serial/omap-serial.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 82d35dbbfa6c..16ab7ea07fa3 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -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);
}
/**
--
2.41.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 10/10] serial: drivers: switch ch and flag to u8
2023-07-12 8:18 [PATCH 00/10] tty: u8 conversion preparation Jiri Slaby (SUSE)
` (8 preceding siblings ...)
2023-07-12 8:18 ` [PATCH 09/10] serial: omap-serial: remove flag from serial_omap_rdi() Jiri Slaby (SUSE)
@ 2023-07-12 8:18 ` Jiri Slaby (SUSE)
2023-07-12 9:44 ` Maciej W. Rozycki
` (3 more replies)
9 siblings, 4 replies; 20+ messages in thread
From: Jiri Slaby (SUSE) @ 2023-07-12 8:18 UTC (permalink / raw)
To: gregkh
Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE), Tobias Klauser,
Russell King, Vineet Gupta, Richard Genoud, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea, Alexander Shiyan, Baruch Siach,
Maciej W. Rozycki, Taichi Sugaya, Takao Orito, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
NXP Linux Team, Kevin Cernekee, Krzysztof Kozlowski, Alim Akhtar,
Laxman Dewangan, Thierry Reding, Jonathan Hunter, Palmer Dabbelt,
Paul Walmsley, Orson Zhai, Baolin Wang, Chunyan Zhang,
Patrice Chotard, Maxime Coquelin, Alexandre Torgue, Hammer Hsieh
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.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Cc: Tobias Klauser <tklauser@distanz.ch>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Vineet Gupta <vgupta@kernel.org>
Cc: Richard Genoud <richard.genoud@gmail.com>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Claudiu Beznea <claudiu.beznea@microchip.com>
Cc: Alexander Shiyan <shc_work@mail.ru>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: "Maciej W. Rozycki" <macro@orcam.me.uk>
Cc: Taichi Sugaya <sugaya.taichi@socionext.com>
Cc: Takao Orito <orito.takao@socionext.com>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP Linux Team <linux-imx@nxp.com>
Cc: Kevin Cernekee <cernekee@gmail.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Alim Akhtar <alim.akhtar@samsung.com>
Cc: Laxman Dewangan <ldewangan@nvidia.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Jonathan Hunter <jonathanh@nvidia.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Orson Zhai <orsonzhai@gmail.com>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Chunyan Zhang <zhang.lyra@gmail.com>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: Hammer Hsieh <hammerh0314@gmail.com>
---
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(-)
diff --git a/drivers/tty/serial/21285.c b/drivers/tty/serial/21285.c
index 185462fd959c..d756fcc884cb 100644
--- a/drivers/tty/serial/21285.c
+++ b/drivers/tty/serial/21285.c
@@ -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--) {
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index 16aeb1420137..0533e75adca9 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -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);
diff --git a/drivers/tty/serial/altera_jtaguart.c b/drivers/tty/serial/altera_jtaguart.c
index 9f843d1cee40..6203ca1de769 100644
--- a/drivers/tty/serial/altera_jtaguart.c
+++ b/drivers/tty/serial/altera_jtaguart.c
@@ -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) {
diff --git a/drivers/tty/serial/altera_uart.c b/drivers/tty/serial/altera_uart.c
index 9ce3d24af536..a9c41942190c 100644
--- a/drivers/tty/serial/altera_uart.c
+++ b/drivers/tty/serial/altera_uart.c
@@ -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) {
diff --git a/drivers/tty/serial/amba-pl010.c b/drivers/tty/serial/amba-pl010.c
index a98fae2ca422..b5a7404cbacb 100644
--- a/drivers/tty/serial/amba-pl010.c
+++ b/drivers/tty/serial/amba-pl010.c
@@ -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--) {
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index c5c3f4674459..8bddc7470bcc 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -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);
diff --git a/drivers/tty/serial/apbuart.c b/drivers/tty/serial/apbuart.c
index 915ee4b0d594..372db052573d 100644
--- a/drivers/tty/serial/apbuart.c
+++ b/drivers/tty/serial/apbuart.c
@@ -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);
diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c
index 835903488acb..ad4ae19b6ce3 100644
--- a/drivers/tty/serial/arc_uart.c
+++ b/drivers/tty/serial/arc_uart.c
@@ -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),
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 3467a875641a..ec54436969dc 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -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;
diff --git a/drivers/tty/serial/clps711x.c b/drivers/tty/serial/clps711x.c
index e49bc4019b50..be8b8788d2e2 100644
--- a/drivers/tty/serial/clps711x.c
+++ b/drivers/tty/serial/clps711x.c
@@ -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;
diff --git a/drivers/tty/serial/digicolor-usart.c b/drivers/tty/serial/digicolor-usart.c
index ed197705f7ee..128b5479e813 100644
--- a/drivers/tty/serial/digicolor-usart.c
+++ b/drivers/tty/serial/digicolor-usart.c
@@ -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;
diff --git a/drivers/tty/serial/dz.c b/drivers/tty/serial/dz.c
index 6b7ed7f2f3ca..667f52e83277 100644
--- a/drivers/tty/serial/dz.c
+++ b/drivers/tty/serial/dz.c
@@ -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) {
diff --git a/drivers/tty/serial/ip22zilog.c b/drivers/tty/serial/ip22zilog.c
index b1f27e168135..845ff706bc59 100644
--- a/drivers/tty/serial/ip22zilog.c
+++ b/drivers/tty/serial/ip22zilog.c
@@ -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 (;;) {
diff --git a/drivers/tty/serial/max3100.c b/drivers/tty/serial/max3100.c
index 86dcbff8faa3..5efb2b593be3 100644
--- a/drivers/tty/serial/max3100.c
+++ b/drivers/tty/serial/max3100.c
@@ -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__);
diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
index 997e39449766..416d553b73a7 100644
--- a/drivers/tty/serial/max310x.c
+++ b/drivers/tty/serial/max310x.c
@@ -669,7 +669,8 @@ static void max310x_batch_read(struct uart_port *port, u8 *rxbuf, unsigned int l
static 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.
diff --git a/drivers/tty/serial/mcf.c b/drivers/tty/serial/mcf.c
index 3239babe12a4..1666ce012e5e 100644
--- a/drivers/tty/serial/mcf.c
+++ b/drivers/tty/serial/mcf.c
@@ -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);
diff --git a/drivers/tty/serial/milbeaut_usio.c b/drivers/tty/serial/milbeaut_usio.c
index 44988a2941b8..70a910085e93 100644
--- a/drivers/tty/serial/milbeaut_usio.c
+++ b/drivers/tty/serial/milbeaut_usio.c
@@ -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;
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index a368f4293967..2ef10997df18 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -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);
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 16ab7ea07fa3..2c11870fa894 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -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;
diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c
index 444fa4b654ac..73c60f5ea027 100644
--- a/drivers/tty/serial/pxa.c
+++ b/drivers/tty/serial/pxa.c
@@ -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 {
diff --git a/drivers/tty/serial/rp2.c b/drivers/tty/serial/rp2.c
index 749b873a5d99..de220ac8ca54 100644
--- a/drivers/tty/serial/rp2.c
+++ b/drivers/tty/serial/rp2.c
@@ -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;
diff --git a/drivers/tty/serial/sa1100.c b/drivers/tty/serial/sa1100.c
index 55107bbc00ce..ad011f1e2f4d 100644
--- a/drivers/tty/serial/sa1100.c
+++ b/drivers/tty/serial/sa1100.c
@@ -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));
diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c
index b29e9dfd81a6..aa4a184f4a6c 100644
--- a/drivers/tty/serial/samsung_tty.c
+++ b/drivers/tty/serial/samsung_tty.c
@@ -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) {
/*
diff --git a/drivers/tty/serial/sb1250-duart.c b/drivers/tty/serial/sb1250-duart.c
index b6de0dc51f29..f3cd69346482 100644
--- a/drivers/tty/serial/sb1250-duart.c
+++ b/drivers/tty/serial/sb1250-duart.c
@@ -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);
diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index 2e7e7c409cf2..cfffc730ba34 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -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,
diff --git a/drivers/tty/serial/sccnxp.c b/drivers/tty/serial/sccnxp.c
index 4f2fc5f7bb19..31ee46eba580 100644
--- a/drivers/tty/serial/sccnxp.c
+++ b/drivers/tty/serial/sccnxp.c
@@ -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);
diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c
index 1cf08b33456c..813ae97159c4 100644
--- a/drivers/tty/serial/serial-tegra.c
+++ b/drivers/tty/serial/serial-tegra.c
@@ -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))
diff --git a/drivers/tty/serial/serial_txx9.c b/drivers/tty/serial/serial_txx9.c
index eab387b01e36..be08fb6f749c 100644
--- a/drivers/tty/serial/serial_txx9.c
+++ b/drivers/tty/serial/serial_txx9.c
@@ -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);
diff --git a/drivers/tty/serial/sifive.c b/drivers/tty/serial/sifive.c
index 1f565a216e74..c00080f12cab 100644
--- a/drivers/tty/serial/sifive.c
+++ b/drivers/tty/serial/sifive.c
@@ -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);
diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c
index b58f51296ace..8f6fd1cd91d7 100644
--- a/drivers/tty/serial/sprd_serial.c
+++ b/drivers/tty/serial/sprd_serial.c
@@ -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);
diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c
index aa471c9c24d9..387bc69bb1fe 100644
--- a/drivers/tty/serial/st-asc.c
+++ b/drivers/tty/serial/st-asc.c
@@ -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;
/*
diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
index e9e11a259621..be47cd343cf6 100644
--- a/drivers/tty/serial/stm32-usart.c
+++ b/drivers/tty/serial/stm32-usart.c
@@ -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;
diff --git a/drivers/tty/serial/sunplus-uart.c b/drivers/tty/serial/sunplus-uart.c
index 727942c43c45..3aacd5eb414c 100644
--- a/drivers/tty/serial/sunplus-uart.c
+++ b/drivers/tty/serial/sunplus-uart.c
@@ -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);
diff --git a/drivers/tty/serial/zs.c b/drivers/tty/serial/zs.c
index 730c648e32ff..65ca4da6e368 100644
--- a/drivers/tty/serial/zs.c
+++ b/drivers/tty/serial/zs.c
@@ -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);
--
2.41.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 02/10] tty: sysrq: switch sysrq handlers from int to u8
2023-07-12 8:18 ` [PATCH 02/10] tty: sysrq: switch sysrq handlers from int to u8 Jiri Slaby (SUSE)
@ 2023-07-12 8:34 ` Thomas Zimmermann
2023-07-12 13:37 ` Paul E. McKenney
` (2 subsequent siblings)
3 siblings, 0 replies; 20+ messages in thread
From: Thomas Zimmermann @ 2023-07-12 8:34 UTC (permalink / raw)
To: Jiri Slaby (SUSE), gregkh
Cc: linux-serial, linux-kernel, Richard Henderson, Ivan Kokshaysky,
Matt Turner, Huacai Chen, WANG Xuerui, Thomas Bogendoerfer,
Michael Ellerman, Nicholas Piggin, Christophe Leroy,
David S. Miller, Maarten Lankhorst, Maxime Ripard, David Airlie,
Daniel Vetter, Jason Wessel, Daniel Thompson, Douglas Anderson,
Rafael J. Wysocki, Len Brown, Pavel Machek, Paul E. McKenney,
Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
Josh Triplett, Boqun Feng, Steven Rostedt, Mathieu Desnoyers,
Lai Jiangshan, Zqiang
[-- Attachment #1.1: Type: text/plain, Size: 14001 bytes --]
Am 12.07.23 um 10:18 schrieb 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) <jirislaby@kernel.org>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
> Cc: Matt Turner <mattst88@gmail.com>
> Cc: Huacai Chen <chenhuacai@kernel.org>
> Cc: WANG Xuerui <kernel@xen0n.name>
> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Jason Wessel <jason.wessel@windriver.com>
> Cc: Daniel Thompson <daniel.thompson@linaro.org>
> Cc: Douglas Anderson <dianders@chromium.org>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Cc: Len Brown <len.brown@intel.com>
> Cc: Pavel Machek <pavel@ucw.cz>
> Cc: "Paul E. McKenney" <paulmck@kernel.org>
> Cc: Frederic Weisbecker <frederic@kernel.org>
> Cc: Neeraj Upadhyay <quic_neeraju@quicinc.com>
> Cc: Joel Fernandes <joel@joelfernandes.org>
> Cc: Josh Triplett <josh@joshtriplett.org>
> Cc: Boqun Feng <boqun.feng@gmail.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> Cc: Lai Jiangshan <jiangshanlai@gmail.com>
> Cc: Zqiang <qiang.zhang1211@gmail.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de> # DRM
> ---
> 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(-)
>
> diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c
> index b650ff1cb022..91fb3714ebc2 100644
> --- a/arch/alpha/kernel/setup.c
> +++ b/arch/alpha/kernel/setup.c
> @@ -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();
> }
> diff --git a/arch/loongarch/kernel/sysrq.c b/arch/loongarch/kernel/sysrq.c
> index 366baef72d29..e663c10fa39c 100644
> --- a/arch/loongarch/kernel/sysrq.c
> +++ b/arch/loongarch/kernel/sysrq.c
> @@ -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
> diff --git a/arch/mips/kernel/sysrq.c b/arch/mips/kernel/sysrq.c
> index 9c1a2019113b..2e98049fe783 100644
> --- a/arch/mips/kernel/sysrq.c
> +++ b/arch/mips/kernel/sysrq.c
> @@ -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
> diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
> index ee17270d35d0..3b6f524c790e 100644
> --- a/arch/powerpc/xmon/xmon.c
> +++ b/arch/powerpc/xmon/xmon.c
> @@ -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();
> diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
> index b51d8fb0ecdc..4dee88af403f 100644
> --- a/arch/sparc/kernel/process_64.c
> +++ b/arch/sparc/kernel/process_64.c
> @@ -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();
> }
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 61a5d450cc20..d612133e2cf7 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -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);
> }
> diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
> index 13465e4cca9b..1271a82c0887 100644
> --- a/drivers/tty/sysrq.c
> +++ b/drivers/tty/sysrq.c
> @@ -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();
> }
> diff --git a/include/linux/sysrq.h b/include/linux/sysrq.h
> index 3a582ec7a2f1..bb8d07814b0e 100644
> --- a/include/linux/sysrq.h
> +++ b/include/linux/sysrq.h
> @@ -30,7 +30,7 @@
> #define SYSRQ_ENABLE_RTNICE 0x0100
>
> struct 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;
> diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c
> index d5e9ccde3ab8..621037a0aa87 100644
> --- a/kernel/debug/debug_core.c
> +++ b/kernel/debug/debug_core.c
> @@ -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");
> diff --git a/kernel/power/poweroff.c b/kernel/power/poweroff.c
> index 562aa0e450ed..1f306f158696 100644
> --- a/kernel/power/poweroff.c
> +++ b/kernel/power/poweroff.c
> @@ -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);
> diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h
> index b10b8349bb2a..6f06dc12904a 100644
> --- a/kernel/rcu/tree_stall.h
> +++ b/kernel/rcu/tree_stall.h
> @@ -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();
> }
--
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)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 10/10] serial: drivers: switch ch and flag to u8
2023-07-12 8:18 ` [PATCH 10/10] serial: drivers: switch ch and flag to u8 Jiri Slaby (SUSE)
@ 2023-07-12 9:44 ` Maciej W. Rozycki
2023-07-12 12:35 ` Thierry Reding
` (2 subsequent siblings)
3 siblings, 0 replies; 20+ messages in thread
From: Maciej W. Rozycki @ 2023-07-12 9:44 UTC (permalink / raw)
To: Jiri Slaby (SUSE)
Cc: Greg Kroah-Hartman, linux-serial, linux-kernel, Tobias Klauser,
Russell King, Vineet Gupta, Richard Genoud, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea, Alexander Shiyan, Baruch Siach,
Taichi Sugaya, Takao Orito, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
Kevin Cernekee, Krzysztof Kozlowski, Alim Akhtar, Laxman Dewangan,
Thierry Reding, Jonathan Hunter, Palmer Dabbelt, Paul Walmsley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Patrice Chotard,
Maxime Coquelin, Alexandre Torgue, Hammer Hsieh
On Wed, 12 Jul 2023, Jiri Slaby (SUSE) wrote:
> drivers/tty/serial/dz.c | 2 +-
> drivers/tty/serial/sb1250-duart.c | 3 ++-
> drivers/tty/serial/zs.c | 3 ++-
For these:
Acked-by: Maciej W. Rozycki <macro@orcam.me.uk>
Thanks for making this clean-up.
Maciej
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 10/10] serial: drivers: switch ch and flag to u8
2023-07-12 8:18 ` [PATCH 10/10] serial: drivers: switch ch and flag to u8 Jiri Slaby (SUSE)
2023-07-12 9:44 ` Maciej W. Rozycki
@ 2023-07-12 12:35 ` Thierry Reding
2023-07-13 13:58 ` Tobias Klauser
2023-07-14 9:45 ` Richard Genoud
3 siblings, 0 replies; 20+ messages in thread
From: Thierry Reding @ 2023-07-12 12:35 UTC (permalink / raw)
To: Jiri Slaby (SUSE)
Cc: gregkh, linux-serial, linux-kernel, Tobias Klauser, Russell King,
Vineet Gupta, Richard Genoud, Nicolas Ferre, Alexandre Belloni,
Claudiu Beznea, Alexander Shiyan, Baruch Siach, Maciej W. Rozycki,
Taichi Sugaya, Takao Orito, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
Kevin Cernekee, Krzysztof Kozlowski, Alim Akhtar, Laxman Dewangan,
Jonathan Hunter, Palmer Dabbelt, Paul Walmsley, Orson Zhai,
Baolin Wang, Chunyan Zhang, Patrice Chotard, Maxime Coquelin,
Alexandre Torgue, Hammer Hsieh
[-- Attachment #1: Type: text/plain, Size: 172 bytes --]
On Wed, Jul 12, 2023 at 10:18:11AM +0200, Jiri Slaby (SUSE) wrote:
[...]
> drivers/tty/serial/serial-tegra.c | 7 +++----
Acked-by: Thierry Reding <treding@nvidia.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 02/10] tty: sysrq: switch sysrq handlers from int to u8
2023-07-12 8:18 ` [PATCH 02/10] tty: sysrq: switch sysrq handlers from int to u8 Jiri Slaby (SUSE)
2023-07-12 8:34 ` Thomas Zimmermann
@ 2023-07-12 13:37 ` Paul E. McKenney
2023-07-12 15:19 ` Daniel Thompson
2023-07-13 2:45 ` WANG Xuerui
3 siblings, 0 replies; 20+ messages in thread
From: Paul E. McKenney @ 2023-07-12 13:37 UTC (permalink / raw)
To: Jiri Slaby (SUSE)
Cc: gregkh, linux-serial, linux-kernel, Richard Henderson,
Ivan Kokshaysky, Matt Turner, Huacai Chen, WANG Xuerui,
Thomas Bogendoerfer, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, David S. Miller, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter,
Jason Wessel, Daniel Thompson, Douglas Anderson,
Rafael J. Wysocki, Len Brown, Pavel Machek, Frederic Weisbecker,
Neeraj Upadhyay, Joel Fernandes, Josh Triplett, Boqun Feng,
Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan, Zqiang
On Wed, Jul 12, 2023 at 10:18:03AM +0200, Jiri Slaby (SUSE) wrote:
> The passed parameter to sysrq handlers is a key (a character). So change
> the type from 'int' to 'u8'. Let it specifically be 'u8' for two
> reasons:
> * unsigned: unsigned values come from the upper layers (devices) and the
> tty layer assumes unsigned on most places, and
> * 8-bit: as that what's supposed to be one day in all the layers built
> on the top of tty. (Currently, we use mostly 'unsigned char' and
> somewhere still only 'char'. (But that also translates to the former
> thanks to -funsigned-char.))
>
> Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
> Cc: Matt Turner <mattst88@gmail.com>
> Cc: Huacai Chen <chenhuacai@kernel.org>
> Cc: WANG Xuerui <kernel@xen0n.name>
> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Jason Wessel <jason.wessel@windriver.com>
> Cc: Daniel Thompson <daniel.thompson@linaro.org>
> Cc: Douglas Anderson <dianders@chromium.org>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Cc: Len Brown <len.brown@intel.com>
> Cc: Pavel Machek <pavel@ucw.cz>
> Cc: "Paul E. McKenney" <paulmck@kernel.org>
> Cc: Frederic Weisbecker <frederic@kernel.org>
> Cc: Neeraj Upadhyay <quic_neeraju@quicinc.com>
> Cc: Joel Fernandes <joel@joelfernandes.org>
> Cc: Josh Triplett <josh@joshtriplett.org>
> Cc: Boqun Feng <boqun.feng@gmail.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> Cc: Lai Jiangshan <jiangshanlai@gmail.com>
> Cc: Zqiang <qiang.zhang1211@gmail.com>
From an RCU perspective:
Acked-by: Paul E. McKenney <paulmck@kernel.org>
> ---
> 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(-)
>
> diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c
> index b650ff1cb022..91fb3714ebc2 100644
> --- a/arch/alpha/kernel/setup.c
> +++ b/arch/alpha/kernel/setup.c
> @@ -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();
> }
> diff --git a/arch/loongarch/kernel/sysrq.c b/arch/loongarch/kernel/sysrq.c
> index 366baef72d29..e663c10fa39c 100644
> --- a/arch/loongarch/kernel/sysrq.c
> +++ b/arch/loongarch/kernel/sysrq.c
> @@ -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
> diff --git a/arch/mips/kernel/sysrq.c b/arch/mips/kernel/sysrq.c
> index 9c1a2019113b..2e98049fe783 100644
> --- a/arch/mips/kernel/sysrq.c
> +++ b/arch/mips/kernel/sysrq.c
> @@ -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
> diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
> index ee17270d35d0..3b6f524c790e 100644
> --- a/arch/powerpc/xmon/xmon.c
> +++ b/arch/powerpc/xmon/xmon.c
> @@ -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();
> diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
> index b51d8fb0ecdc..4dee88af403f 100644
> --- a/arch/sparc/kernel/process_64.c
> +++ b/arch/sparc/kernel/process_64.c
> @@ -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();
> }
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 61a5d450cc20..d612133e2cf7 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -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);
> }
> diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
> index 13465e4cca9b..1271a82c0887 100644
> --- a/drivers/tty/sysrq.c
> +++ b/drivers/tty/sysrq.c
> @@ -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();
> }
> diff --git a/include/linux/sysrq.h b/include/linux/sysrq.h
> index 3a582ec7a2f1..bb8d07814b0e 100644
> --- a/include/linux/sysrq.h
> +++ b/include/linux/sysrq.h
> @@ -30,7 +30,7 @@
> #define SYSRQ_ENABLE_RTNICE 0x0100
>
> struct 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;
> diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c
> index d5e9ccde3ab8..621037a0aa87 100644
> --- a/kernel/debug/debug_core.c
> +++ b/kernel/debug/debug_core.c
> @@ -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");
> diff --git a/kernel/power/poweroff.c b/kernel/power/poweroff.c
> index 562aa0e450ed..1f306f158696 100644
> --- a/kernel/power/poweroff.c
> +++ b/kernel/power/poweroff.c
> @@ -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);
> diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h
> index b10b8349bb2a..6f06dc12904a 100644
> --- a/kernel/rcu/tree_stall.h
> +++ b/kernel/rcu/tree_stall.h
> @@ -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();
> }
> --
> 2.41.0
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 02/10] tty: sysrq: switch sysrq handlers from int to u8
2023-07-12 8:18 ` [PATCH 02/10] tty: sysrq: switch sysrq handlers from int to u8 Jiri Slaby (SUSE)
2023-07-12 8:34 ` Thomas Zimmermann
2023-07-12 13:37 ` Paul E. McKenney
@ 2023-07-12 15:19 ` Daniel Thompson
2023-07-13 2:45 ` WANG Xuerui
3 siblings, 0 replies; 20+ messages in thread
From: Daniel Thompson @ 2023-07-12 15:19 UTC (permalink / raw)
To: Jiri Slaby (SUSE)
Cc: gregkh, linux-serial, linux-kernel, Richard Henderson,
Ivan Kokshaysky, Matt Turner, Huacai Chen, WANG Xuerui,
Thomas Bogendoerfer, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, David S. Miller, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter,
Jason Wessel, Douglas Anderson, Rafael J. Wysocki, Len Brown,
Pavel Machek, Paul E. McKenney, Frederic Weisbecker,
Neeraj Upadhyay, Joel Fernandes, Josh Triplett, Boqun Feng,
Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan, Zqiang
On Wed, Jul 12, 2023 at 10:18:03AM +0200, Jiri Slaby (SUSE) wrote:
> The passed parameter to sysrq handlers is a key (a character). So change
> the type from 'int' to 'u8'. Let it specifically be 'u8' for two
> reasons:
> * unsigned: unsigned values come from the upper layers (devices) and the
> tty layer assumes unsigned on most places, and
> * 8-bit: as that what's supposed to be one day in all the layers built
> on the top of tty. (Currently, we use mostly 'unsigned char' and
> somewhere still only 'char'. (But that also translates to the former
> thanks to -funsigned-char.))
>
> Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
> <snip>
> Cc: Jason Wessel <jason.wessel@windriver.com>
> Cc: Daniel Thompson <daniel.thompson@linaro.org>
> Cc: Douglas Anderson <dianders@chromium.org>
For kgdb:
Acked-by: Daniel Thompson <daniel.thompson@linaro.org>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 08/10] serial: arc_uart: simplify flags handling in arc_serial_rx_chars()
2023-07-12 8:18 ` [PATCH 08/10] serial: arc_uart: simplify flags handling in arc_serial_rx_chars() Jiri Slaby (SUSE)
@ 2023-07-13 0:58 ` Vineet Gupta
0 siblings, 0 replies; 20+ messages in thread
From: Vineet Gupta @ 2023-07-13 0:58 UTC (permalink / raw)
To: Jiri Slaby (SUSE), gregkh; +Cc: linux-serial, linux-kernel, Vineet Gupta
On 7/12/23 01:18, Jiri Slaby (SUSE) wrote:
> * 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.
>
> Signed-off-by: Jiri Slaby (SUSE)<jirislaby@kernel.org>
> Cc: Vineet Gupta<vgupta@kernel.org>
Thanks for the cleanup.
Acked-by: Vineet Gupta <vgupta@kernel.org>
Th,
-Vineet
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 02/10] tty: sysrq: switch sysrq handlers from int to u8
2023-07-12 8:18 ` [PATCH 02/10] tty: sysrq: switch sysrq handlers from int to u8 Jiri Slaby (SUSE)
` (2 preceding siblings ...)
2023-07-12 15:19 ` Daniel Thompson
@ 2023-07-13 2:45 ` WANG Xuerui
3 siblings, 0 replies; 20+ messages in thread
From: WANG Xuerui @ 2023-07-13 2:45 UTC (permalink / raw)
To: Jiri Slaby (SUSE), gregkh
Cc: linux-serial, linux-kernel, Richard Henderson, Ivan Kokshaysky,
Matt Turner, Huacai Chen, Thomas Bogendoerfer, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, David S. Miller,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Daniel Vetter, Jason Wessel, Daniel Thompson, Douglas Anderson,
Rafael J. Wysocki, Len Brown, Pavel Machek, Paul E. McKenney,
Frederic Weisbecker, Neeraj Upadhyay, Joel Fernandes,
Josh Triplett, Boqun Feng, Steven Rostedt, Mathieu Desnoyers,
Lai Jiangshan, Zqiang
On 2023/7/12 16:18, Jiri Slaby (SUSE) wrote:
> The passed parameter to sysrq handlers is a key (a character). So change
> the type from 'int' to 'u8'. Let it specifically be 'u8' for two
> reasons:
> * unsigned: unsigned values come from the upper layers (devices) and the
> tty layer assumes unsigned on most places, and
> * 8-bit: as that what's supposed to be one day in all the layers built
> on the top of tty. (Currently, we use mostly 'unsigned char' and
> somewhere still only 'char'. (But that also translates to the former
> thanks to -funsigned-char.))
>
> Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
> Cc: Matt Turner <mattst88@gmail.com>
> Cc: Huacai Chen <chenhuacai@kernel.org>
> Cc: WANG Xuerui <kernel@xen0n.name>
> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Jason Wessel <jason.wessel@windriver.com>
> Cc: Daniel Thompson <daniel.thompson@linaro.org>
> Cc: Douglas Anderson <dianders@chromium.org>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Cc: Len Brown <len.brown@intel.com>
> Cc: Pavel Machek <pavel@ucw.cz>
> Cc: "Paul E. McKenney" <paulmck@kernel.org>
> Cc: Frederic Weisbecker <frederic@kernel.org>
> Cc: Neeraj Upadhyay <quic_neeraju@quicinc.com>
> Cc: Joel Fernandes <joel@joelfernandes.org>
> Cc: Josh Triplett <josh@joshtriplett.org>
> Cc: Boqun Feng <boqun.feng@gmail.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> Cc: Lai Jiangshan <jiangshanlai@gmail.com>
> Cc: Zqiang <qiang.zhang1211@gmail.com>
> ---
> 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]
> diff --git a/arch/loongarch/kernel/sysrq.c b/arch/loongarch/kernel/sysrq.c
> index 366baef72d29..e663c10fa39c 100644
> --- a/arch/loongarch/kernel/sysrq.c
> +++ b/arch/loongarch/kernel/sysrq.c
> @@ -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
> [snip]
Acked-by: WANG Xuerui <git@xen0n.name> # loongarch
Thanks!
--
WANG "xen0n" Xuerui
Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 10/10] serial: drivers: switch ch and flag to u8
2023-07-12 8:18 ` [PATCH 10/10] serial: drivers: switch ch and flag to u8 Jiri Slaby (SUSE)
2023-07-12 9:44 ` Maciej W. Rozycki
2023-07-12 12:35 ` Thierry Reding
@ 2023-07-13 13:58 ` Tobias Klauser
2023-07-14 9:45 ` Richard Genoud
3 siblings, 0 replies; 20+ messages in thread
From: Tobias Klauser @ 2023-07-13 13:58 UTC (permalink / raw)
To: Jiri Slaby (SUSE)
Cc: gregkh, linux-serial, linux-kernel, Russell King, Vineet Gupta,
Richard Genoud, Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
Alexander Shiyan, Baruch Siach, Maciej W. Rozycki, Taichi Sugaya,
Takao Orito, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, NXP Linux Team, Kevin Cernekee,
Krzysztof Kozlowski, Alim Akhtar, Laxman Dewangan, Thierry Reding,
Jonathan Hunter, Palmer Dabbelt, Paul Walmsley, Orson Zhai,
Baolin Wang, Chunyan Zhang, Patrice Chotard, Maxime Coquelin,
Alexandre Torgue, Hammer Hsieh
On 2023-07-12 at 10:18:11 +0200, Jiri Slaby (SUSE) <jirislaby@kernel.org> wrote:
[...]
> drivers/tty/serial/altera_jtaguart.c | 2 +-
> drivers/tty/serial/altera_uart.c | 2 +-
For these:
Acked-by: Tobias Klauser <tklauser@distanz.ch>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 10/10] serial: drivers: switch ch and flag to u8
2023-07-12 8:18 ` [PATCH 10/10] serial: drivers: switch ch and flag to u8 Jiri Slaby (SUSE)
` (2 preceding siblings ...)
2023-07-13 13:58 ` Tobias Klauser
@ 2023-07-14 9:45 ` Richard Genoud
3 siblings, 0 replies; 20+ messages in thread
From: Richard Genoud @ 2023-07-14 9:45 UTC (permalink / raw)
To: Jiri Slaby (SUSE), gregkh
Cc: linux-serial, linux-kernel, Tobias Klauser, Russell King,
Vineet Gupta, Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
Alexander Shiyan, Baruch Siach, Maciej W. Rozycki, Taichi Sugaya,
Takao Orito, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, NXP Linux Team, Kevin Cernekee,
Krzysztof Kozlowski, Alim Akhtar, Laxman Dewangan, Thierry Reding,
Jonathan Hunter, Palmer Dabbelt, Paul Walmsley, Orson Zhai,
Baolin Wang, Chunyan Zhang, Patrice Chotard, Maxime Coquelin,
Alexandre Torgue, Hammer Hsieh
Le 12/07/2023 à 10:18, Jiri Slaby (SUSE) a écrit :
> drivers/tty/serial/atmel_serial.c | 2 +-
Acked-by: Richard GENOUD <richard.genoud@gmail.com>
Thanks !
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2023-07-14 9:46 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-12 8:18 [PATCH 00/10] tty: u8 conversion preparation Jiri Slaby (SUSE)
2023-07-12 8:18 ` [PATCH 01/10] tty: sysrq: rename and re-type i in sysrq_handle_loglevel() Jiri Slaby (SUSE)
2023-07-12 8:18 ` [PATCH 02/10] tty: sysrq: switch sysrq handlers from int to u8 Jiri Slaby (SUSE)
2023-07-12 8:34 ` Thomas Zimmermann
2023-07-12 13:37 ` Paul E. McKenney
2023-07-12 15:19 ` Daniel Thompson
2023-07-13 2:45 ` WANG Xuerui
2023-07-12 8:18 ` [PATCH 03/10] tty: sysrq: switch the rest of keys " Jiri Slaby (SUSE)
2023-07-12 8:18 ` [PATCH 04/10] tty: sysrq: use switch in sysrq_key_table_key2index() Jiri Slaby (SUSE)
2023-07-12 8:18 ` [PATCH 05/10] serial: convert uart sysrq handling to u8 Jiri Slaby (SUSE)
2023-07-12 8:18 ` [PATCH 06/10] serial: make uart_insert_char() accept u8s Jiri Slaby (SUSE)
2023-07-12 8:18 ` [PATCH 07/10] serial: pass state to __uart_start() directly Jiri Slaby (SUSE)
2023-07-12 8:18 ` [PATCH 08/10] serial: arc_uart: simplify flags handling in arc_serial_rx_chars() Jiri Slaby (SUSE)
2023-07-13 0:58 ` Vineet Gupta
2023-07-12 8:18 ` [PATCH 09/10] serial: omap-serial: remove flag from serial_omap_rdi() Jiri Slaby (SUSE)
2023-07-12 8:18 ` [PATCH 10/10] serial: drivers: switch ch and flag to u8 Jiri Slaby (SUSE)
2023-07-12 9:44 ` Maciej W. Rozycki
2023-07-12 12:35 ` Thierry Reding
2023-07-13 13:58 ` Tobias Klauser
2023-07-14 9:45 ` Richard Genoud
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).