Re: [PATCH v2] serial: amba-pl011: add RS485 support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 25. 06. 21, 2:15, Lino Sanfilippo wrote:
+static int pl011_rs485_config(struct uart_port *port,
+			      struct serial_rs485 *rs485)
+{
+	struct uart_amba_port *uap =
+		container_of(port, struct uart_amba_port, port);
+
+	/* pick sane settings if the user hasn't */
+	if (!!(rs485->flags & SER_RS485_RTS_ON_SEND) ==

Why the !! in an if statement?

+	    !!(rs485->flags & SER_RS485_RTS_AFTER_SEND)) {

Same here, why?


This was copied from serial8250_em485_config(). But I think we can simply use

	if (rs485->flags & SER_RS485_RTS_AFTER_SEND)
		rs485->flags &= ~SER_RS485_RTS_ON_SEND;
	else
		rs485->flags |= SER_RS485_RTS_ON_SEND;

instead. I will adjust the code accordingly.

This is different. You want to set ON_SEND when none is set. And unset AFTER_SEND when both are set. In your code, when both are set, you leave AFTER_SEND.

regards,
--
js
suse labs



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux