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

From: Théo Lebrun
Date: Thu Oct 26 2023 - 10:37:47 EST


Hello,

On Thu Oct 26, 2023 at 4:24 PM CEST, Hugo Villeneuve wrote:
> On Thu, 26 Oct 2023 12:41:21 +0200
> 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>
> > ---
> > drivers/tty/serial/amba-pl011.c | 46 +++++++++++++++++++++--------------------
> > 1 file changed, 24 insertions(+), 22 deletions(-)
> >
> > diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> > index 0d53973374de..bb3082c4d35c 100644
> > --- a/drivers/tty/serial/amba-pl011.c
> > +++ b/drivers/tty/serial/amba-pl011.c
> > @@ -1087,7 +1087,6 @@ static void pl011_dma_rx_poll(struct timer_list *t)
> > */
> > if (jiffies_to_msecs(jiffies - dmarx->last_jiffies)
> > > uap->dmarx.poll_timeout) {
> > -
>
> This should go into a separate patch, or simply be merged with one
> of your other coding style/whitespace cleanup patches.

Indeed, added to "tty: serial: amba-pl011: cleanup driver". Thanks.

Regards,

--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com