Re: [PATCHv2-next 2/3] serial/sysrq: Add MAGIC_SYSRQ_SERIAL_SEQUENCE

Randy Dunlap
2020-01-14T17:51:49Z

On 1/14/20 9:19 AM, Dmitry Safonov wrote:
> +static bool uart_try_toggle_sysrq(struct uart_port *port, unsigned int ch)
> +{
> + if (ARRAY_SIZE(sysrq_toggle_seq) <= 1)
> + return 0;
> +
> + BUILD_BUG_ON(ARRAY_SIZE(sysrq_toggle_seq) >= sizeof(port->sysrq_seq)*U8_MAX);

That sizeof(...) is confusing (to me). I would just write:

+ BUILD_BUG_ON(ARRAY_SIZE(sysrq_toggle_seq) >= U8_MAX);

> + if (sysrq_toggle_seq[port->sysrq_seq] != ch) {
> + port->sysrq_seq = 0;
> + return 0;
> + }

cheers.
--
~Randy