serial: arc_uart: simplify flags handling in arc_serial_rx_chars()
authorJiri Slaby <jirislaby@kernel.org>
Wed, 12 Jul 2023 08:18:09 +0000 (10:18 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 25 Jul 2023 17:21:03 +0000 (19:21 +0200)
commit29ec63ef16fce338774b9ba306ea530190bf772a
tree9f17df7c743724cbfe262c3a2acaea47fc54ed33
parent1225541cfd5f0b32edfd680ab6b3af5ad4af36c4
serial: arc_uart: simplify flags handling in arc_serial_rx_chars()

* 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>
Acked-by: Vineet Gupta <vgupta@kernel.org>
Link: https://lore.kernel.org/r/20230712081811.29004-9-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/arc_uart.c