[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2cb9b67e-9bb-4fb2-e974-17050457d3@linux.intel.com>
Date: Thu, 5 Jan 2023 10:51:10 +0200 (EET)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Jiri Slaby <jirislaby@...nel.org>
cc: linux-serial <linux-serial@...r.kernel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Arnd Bergmann <arnd@...db.de>,
Ulf Hansson <ulf.hansson@...aro.org>,
David Lin <dtwlin@...il.com>, Johan Hovold <johan@...nel.org>,
Alex Elder <elder@...nel.org>, Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
NXP Linux Team <linux-imx@....com>,
Oliver Neukum <oneukum@...e.com>,
LKML <linux-kernel@...r.kernel.org>, linux-mmc@...r.kernel.org,
greybus-dev@...ts.linaro.org, linux-staging@...ts.linux.dev,
linuxppc-dev@...ts.ozlabs.org,
linux-arm-kernel@...ts.infradead.org, linux-usb@...r.kernel.org
Subject: Re: [PATCH 07/10] tty: Convert ->dtr_rts() to take bool argument
On Thu, 5 Jan 2023, Jiri Slaby wrote:
> On 04. 01. 23, 16:15, Ilpo Järvinen wrote:
> > Convert the raise/on parameter in ->dtr_rts() to bool through the
> > callchain. The parameter is used like bool. In USB serial, there
> > remains a few implicit bool -> larger type conversions because some
> > devices use u8 in their control messages.
>
> Reviewed-by: Jiri Slaby <jirislaby@...nel.org>
>
> > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
> > ---
> ...
> > --- a/drivers/char/pcmcia/synclink_cs.c
> > +++ b/drivers/char/pcmcia/synclink_cs.c
> > @@ -378,7 +378,7 @@ static void async_mode(MGSLPC_INFO *info);
> > static void tx_timeout(struct timer_list *t);
> > static bool carrier_raised(struct tty_port *port);
> > -static void dtr_rts(struct tty_port *port, int onoff);
> > +static void dtr_rts(struct tty_port *port, bool onoff);
>
> Not anything for this patch, but having this dubbed "onoff" instead of "on"
> makes it really confusing.
>
> > --- a/drivers/mmc/core/sdio_uart.c
> > +++ b/drivers/mmc/core/sdio_uart.c
> > @@ -548,14 +548,14 @@ static bool uart_carrier_raised(struct tty_port
> > *tport)
> > * adjusted during an open, close and hangup.
> > */
> > -static void uart_dtr_rts(struct tty_port *tport, int onoff)
> > +static void uart_dtr_rts(struct tty_port *tport, bool onoff)
> > {
> > struct sdio_uart_port *port =
> > container_of(tport, struct sdio_uart_port, port);
> > int ret = sdio_uart_claim_func(port);
> > if (ret)
> > return;
> > - if (onoff == 0)
> > + if (!onoff)
> > sdio_uart_clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
> > else
> > sdio_uart_set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
>
> Especially here. What does "!onoff" mean? If it were:
>
> if (on)
> sdio_uart_set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
> else
> sdio_uart_clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
>
> it would be a lot more clear.
>
> > --- a/drivers/tty/amiserial.c
> > +++ b/drivers/tty/amiserial.c
> > @@ -1459,7 +1459,7 @@ static bool amiga_carrier_raised(struct tty_port
> > *port)
> > return !(ciab.pra & SER_DCD);
> > }
> > -static void amiga_dtr_rts(struct tty_port *port, int raise)
> > +static void amiga_dtr_rts(struct tty_port *port, bool raise)
>
> Or "raise". That makes sense too and we call it as such in
> tty_port_operations:
>
> > --- a/include/linux/tty_port.h
> > +++ b/include/linux/tty_port.h
> ...
> > @@ -32,7 +32,7 @@ struct tty_struct;
> > */
> > struct tty_port_operations {
> > bool (*carrier_raised)(struct tty_port *port);
> > - void (*dtr_rts)(struct tty_port *port, int raise);
> > + void (*dtr_rts)(struct tty_port *port, bool raise);
> > void (*shutdown)(struct tty_port *port);
> > int (*activate)(struct tty_port *port, struct tty_struct *tty);
> > void (*destruct)(struct tty_port *port);
>
> Care to fix that up too?
Sure. I noticed they were inconsistent but it didn't feel like changing
the name "while at it" would be good as this is long already. I think I'll
make another patch out of the name changes.
--
i.
Powered by blists - more mailing lists