[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <056bff50-f67e-f00f-c98f-ccb427344691@arista.com>
Date: Fri, 10 Jan 2020 22:10:15 +0000
From: Dmitry Safonov <dima@...sta.com>
To: Joe Perches <joe@...ches.com>, linux-kernel@...r.kernel.org
Cc: Dmitry Safonov <0x7f454c46@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jslaby@...e.com>,
Vasiliy Khoruzhick <vasilykh@...sta.com>,
linux-serial@...r.kernel.org
Subject: Re: [PATCH-next 3/3] serial/sysrq: Add MAGIC_SYSRQ_SERIAL_SEQUENCE
Hi Joe,
On 1/10/20 4:50 PM, Joe Perches wrote:
> On Thu, 2020-01-09 at 21:54 +0000, Dmitry Safonov wrote:
>> Many embedded boards have a disconnected TTL level serial which can
>> generate some garbage that can lead to spurious false sysrq detects.
>
> trivia:
>
>> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> []
>> @@ -3081,6 +3081,38 @@ void uart_insert_char(struct uart_port *port, unsigned int status,
> []
>> +const char sysrq_toggle_seq[] = CONFIG_MAGIC_SYSRQ_SERIAL_SEQUENCE;
>
> static const?
Will do, thanks!
>
>> +static int uart_try_toggle_sysrq(struct uart_port *port, unsigned int ch)
>
> This function return might read better as bool not int
Yeah, no hard feelings, will convert.
[..]
>> @@ -243,10 +243,10 @@ struct uart_port {
>> unsigned long sysrq; /* sysrq timeout */
>> unsigned int sysrq_ch; /* char for sysrq */
>> unsigned char has_sysrq;
>> + unsigned char sysrq_seq; /* index in sysrq_toggle_seq */
>
> unsigned int?
>
> Or maybe set a maximum length of MAGIC_SYSRQ_SERIAL_SEQUENCE.
I think, 256 chars should be enough to send on serial (c)
I'm not aware of a way to put the max string length in Kconfig, so I did
in the patch:
BUILD_BUG_ON(ARRAY_SIZE(sysrq_toggle_seq) >=
sizeof(port->sysrq_seq)*U8_MAX);
Do you have something more elegant in your mind?
Thanks,
Dmitry
Powered by blists - more mailing lists