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: <trinity-163a08b4-6e39-4d15-bde2-815342f13fc4-1624620116191@3c-app-gmx-bs05>
Date:   Fri, 25 Jun 2021 13:21:56 +0200
From:   Lino Sanfilippo <LinoSanfilippo@....de>
To:     Jiri Slaby <jirislaby@...nel.org>
Cc:     Greg KH <gregkh@...uxfoundation.org>, linux@...linux.org.uk,
        linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] serial: amba-pl011: add RS485 support


Hi,

> 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
>

Thats right, the logic has slightly changed. I thought this does not matter as long as
we make sure that exactly one of both ON_SEND or AFTER_SEND is set. We can stick with the logic
in serial8250_em485_config() (i.e. always set ON_SEND and delete AFTER_SEND in case
of an invalid setting), but I think this will require more than the four lines that we
have now (especially if we want to avoid the !!).

Thanks,
Lino






Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ