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>] [day] [month] [year] [list]
Message-ID: <X/clgcNQJXN72Ys/@kroah.com>
Date:   Thu, 7 Jan 2021 16:15:13 +0100
From:   Greg KH <gregkh@...uxfoundation.org>
To:     zhangqiumiao1@...wei.com
Cc:     jirislaby@...nel.org, linux-kernel@...r.kernel.org,
        linux-serial@...r.kernel.org
Subject: Re: [PATCH v2] tty: make pl011 serial port driver support 485 mode

On Thu, Jan 07, 2021 at 02:16:41PM +0800, zhangqiumiao1@...wei.com wrote:
> From: Qiumiao Zhang <zhangqiumiao1@...wei.com>
> 
> make pl011 serial port support 485 mode full duplex communication
> 
> Signed-off-by: Qiumiao Zhang <zhangqiumiao1@...wei.com>
> ---
> Changes in v2:
>  - Fix two compilation errors

What changed from the version you sent yesterday with this same subject
line?

>  drivers/tty/serial/amba-pl011.c | 38 +++++++++++++++++++++++++++++++++
>  1 file changed, 38 insertions(+)
> 
> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> index c255476cce28..f6a7fe61e699 100644
> --- a/drivers/tty/serial/amba-pl011.c
> +++ b/drivers/tty/serial/amba-pl011.c
> @@ -44,6 +44,7 @@
> 
>  #include "amba-pl011.h"
> 
> +#define ISEMPTY			1
>  #define UART_NR			14
> 
>  #define SERIAL_AMBA_MAJOR	204
> @@ -1284,14 +1285,33 @@ static inline bool pl011_dma_rx_running(struct uart_amba_port *uap)
>  #define pl011_dma_flush_buffer	NULL
>  #endif
> 
> +static unsigned int pl011_tx_empty(struct uart_port *port);
> +
>  static void pl011_stop_tx(struct uart_port *port)
>  {
> +	unsigned int cr;
> +	unsigned int result;

But below the uap definition please, like kernel style normally is.

>  	struct uart_amba_port *uap =
>  	    container_of(port, struct uart_amba_port, port);
> 
>  	uap->im &= ~UART011_TXIM;
>  	pl011_write(uap->im, uap, REG_IMSC);
>  	pl011_dma_tx_stop(uap);
> +	if (port->rs485.flags & SER_RS485_ENABLED) {
> +		while(1) {
> +			result = pl011_tx_empty(port);
> +			if (ISEMPTY == result) {
> +				break;
> +			}

It's not ok to busy loop forever, sorry.

> +		}
> +		cr = pl011_read(uap, REG_CR);
> +		if (port->rs485.flags & SER_RS485_RTS_AFTER_SEND) {
> +			cr |= UART011_CR_RTS;
> +		} else {
> +			cr &= ~UART011_CR_RTS;
> +		}

Did you run checkpatch on this code?  Please fix up.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ