Théo Lebrun dc00f0cc5e tty: serial: amba-pl011: replace TIOCMBIT macros by static functions
The driver uses two TIOCMBIT macros inside pl011_{get,set}_mctrl to
simplify the logic. Those look scary to checkpatch because they contain
ifs without do-while loops.

Avoid the macros by creating small equivalent static functions; that
lets the compiler do its type checking & avoids checkpatch errors.

For the second instance __assign_bit is not usable because it deals with
unsigned long pointers whereas we have an unsigned int in
pl011_set_mctrl.

This addresses the following checkpatch warnings:

    $ ./scripts/checkpatch.pl --strict --file \
        drivers/tty/serial/amba-pl011.c

    ERROR: Macros starting with if should be enclosed by a do -
           while loop to avoid possible if/else logic defects

    CHECK: Macro argument 'uartbit' may be better as '(uartbit)' to
           avoid precedence issues

    ERROR: Macros starting with if should be enclosed by a do - while
           loop to avoid possible if/else logic defects

    CHECK: Macro argument 'tiocmbit' may be better as '(tiocmbit)' to
           avoid precedence issues

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Link: https://lore.kernel.org/r/20231207-mbly-uart-v6-3-e384afa5e78c@bootlin.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-15 14:24:12 +01:00
..
2023-09-18 11:18:08 +02:00
2023-09-18 11:18:10 +02:00
2023-09-18 11:18:11 +02:00
2023-09-18 11:18:11 +02:00
2022-11-03 03:32:40 +01:00
2023-09-18 11:18:13 +02:00
2023-09-18 11:18:13 +02:00
2023-07-25 19:21:04 +02:00