Re: [PATCH 4/6] tty: serial: amba-pl011: replace TIOCMBIT macros by static functions

From: Linus Walleij
Date: Thu Oct 26 2023 - 09:46:37 EST


On Thu, Oct 26, 2023 at 12:41 PM Théo Lebrun <theo.lebrun@xxxxxxxxxxx> wrote:

> 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.
>
> Signed-off-by: Théo Lebrun <theo.lebrun@xxxxxxxxxxx>

The kernel looks better after this patch than before, so:
Reviewed-by: Linus Walleij <linus.walleij@xxxxxxxxxx>

Since the eternal defines uses masks rather than bits we can't
use __set_bit() & friends in this case and that's life.

Yours,
Linus Walleij