lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <09043f30-c516-e173-3836-5e5dd5f5c472@kernel.org>
Date:   Thu, 5 Jan 2023 07:19:33 +0100
From:   Jiri Slaby <jirislaby@...nel.org>
To:     Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
        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>, 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 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?

thanks,
-- 
js
suse labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ