Re: [PATCHv2-next 2/3] serial/sysrq: Add MAGIC_SYSRQ_SERIAL_SEQUENCE
From: Randy Dunlap
Date: Tue Jan 14 2020 - 12:51:50 EST
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