* [PATCH 1/2] serial: core: Use isdigit() in uart_parse_options()
@ 2026-10-14 14:30 Thorsten Blum
2026-10-14 14:30 ` [PATCH 2/2] serial: earlycon: Use isdigit() in earlycon_init() Thorsten Blum
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Thorsten Blum @ 2026-10-14 14:30 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Hugo Villeneuve, Johan Hovold,
Karl Mehltretter, John Ogness,
Uwe Kleine-König (The Capable Hub)
Cc: Thorsten Blum, linux-kernel, linux-serial
Use isdigit() to replace the open-coded implementation.
Signed-off-by: Thorsten Blum <blum@kernel.org>
---
drivers/tty/serial/serial_core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 6332ed545c89..6509f65dec36 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -14,6 +14,7 @@
#include <linux/sched/signal.h>
#include <linux/init.h>
#include <linux/console.h>
+#include <linux/ctype.h>
#include <linux/gpio/consumer.h>
#include <linux/kernel.h>
#include <linux/of.h>
@@ -2211,7 +2212,7 @@ uart_parse_options(const char *options, int *baud, int *parity,
const char *s = options;
*baud = simple_strtoul(s, NULL, 10);
- while (*s >= '0' && *s <= '9')
+ while (isdigit(*s))
s++;
if (*s)
*parity = *s++;
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] serial: earlycon: Use isdigit() in earlycon_init()
2026-10-14 14:30 [PATCH 1/2] serial: core: Use isdigit() in uart_parse_options() Thorsten Blum
@ 2026-10-14 14:30 ` Thorsten Blum
2026-10-14 14:34 ` sashiko-bot
2026-10-14 14:35 ` [PATCH 1/2] serial: core: Use isdigit() in uart_parse_options() sashiko-bot
2026-10-14 14:54 ` John Ogness
2 siblings, 1 reply; 5+ messages in thread
From: Thorsten Blum @ 2026-10-14 14:30 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Hugo Villeneuve
Cc: Thorsten Blum, linux-kernel, linux-serial
Use isdigit() and a while loop to simplify the backward scan.
Signed-off-by: Thorsten Blum <blum@kernel.org>
---
drivers/tty/serial/earlycon.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
index ce740cdc7ceb..05d99ec6e709 100644
--- a/drivers/tty/serial/earlycon.c
+++ b/drivers/tty/serial/earlycon.c
@@ -11,6 +11,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/console.h>
+#include <linux/ctype.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/io.h>
@@ -59,11 +60,10 @@ static void __init earlycon_init(struct earlycon_device *device,
const char *s;
size_t len;
- /* scan backwards from end of string for first non-numeral */
- for (s = name + strlen(name);
- s > name && s[-1] >= '0' && s[-1] <= '9';
- s--)
- ;
+ /* Scan backwards to split the trailing index from the console name. */
+ s = name + strlen(name);
+ while (s > name && isdigit(s[-1]))
+ s--;
if (*s)
earlycon->index = simple_strtoul(s, NULL, 10);
len = s - name;
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] serial: earlycon: Use isdigit() in earlycon_init()
2026-10-14 14:30 ` [PATCH 2/2] serial: earlycon: Use isdigit() in earlycon_init() Thorsten Blum
@ 2026-10-14 14:34 ` sashiko-bot
0 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-10-14 14:34 UTC (permalink / raw)
To: Thorsten Blum; +Cc: linux-serial
> Use isdigit() and a while loop to simplify the backward scan.
>
> Signed-off-by: Thorsten Blum <blum@kernel.org>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261014143034.104950-3-blum@kernel.org?part=2
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] serial: core: Use isdigit() in uart_parse_options()
2026-10-14 14:30 [PATCH 1/2] serial: core: Use isdigit() in uart_parse_options() Thorsten Blum
2026-10-14 14:30 ` [PATCH 2/2] serial: earlycon: Use isdigit() in earlycon_init() Thorsten Blum
@ 2026-10-14 14:35 ` sashiko-bot
2026-10-14 14:54 ` John Ogness
2 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-10-14 14:35 UTC (permalink / raw)
To: Thorsten Blum; +Cc: linux-serial
> Use isdigit() to replace the open-coded implementation.
>
> Signed-off-by: Thorsten Blum <blum@kernel.org>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261014143034.104950-3-blum@kernel.org?part=1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] serial: core: Use isdigit() in uart_parse_options()
2026-10-14 14:30 [PATCH 1/2] serial: core: Use isdigit() in uart_parse_options() Thorsten Blum
2026-10-14 14:30 ` [PATCH 2/2] serial: earlycon: Use isdigit() in earlycon_init() Thorsten Blum
2026-10-14 14:35 ` [PATCH 1/2] serial: core: Use isdigit() in uart_parse_options() sashiko-bot
@ 2026-10-14 14:54 ` John Ogness
2 siblings, 0 replies; 5+ messages in thread
From: John Ogness @ 2026-10-14 14:54 UTC (permalink / raw)
To: Thorsten Blum, Greg Kroah-Hartman, Jiri Slaby, Hugo Villeneuve,
Johan Hovold, Karl Mehltretter,
Uwe Kleine-König (The Capable Hub)
Cc: Thorsten Blum, linux-kernel, linux-serial
On 2026-10-14, Thorsten Blum <blum@kernel.org> wrote:
> Use isdigit() to replace the open-coded implementation.
>
> Signed-off-by: Thorsten Blum <blum@kernel.org>
Reviewed-by: John Ogness <john.ogness@linutronix.de>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-10-14 14:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-14 14:30 [PATCH 1/2] serial: core: Use isdigit() in uart_parse_options() Thorsten Blum
2026-10-14 14:30 ` [PATCH 2/2] serial: earlycon: Use isdigit() in earlycon_init() Thorsten Blum
2026-10-14 14:34 ` sashiko-bot
2026-10-14 14:35 ` [PATCH 1/2] serial: core: Use isdigit() in uart_parse_options() sashiko-bot
2026-10-14 14:54 ` John Ogness
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox