linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Lukas Wunner <lukas@wunner.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	John Ogness <john.ogness@linutronix.de>,
	Lino Sanfilippo <LinoSanfilippo@gmx.de>,
	linux-serial <linux-serial@vger.kernel.org>
Subject: Re: [PATCH tty-linus] serial: Reduce spinlocked portion of uart_rs485_config()
Date: Fri, 22 Sep 2023 12:30:52 +0300 (EEST)	[thread overview]
Message-ID: <fd131a69-2cfb-7ff1-a3a5-44f591ca766@linux.intel.com> (raw)
In-Reply-To: <20230922040433.GB9800@wunner.de>

[-- Attachment #1: Type: text/plain, Size: 1256 bytes --]

On Fri, 22 Sep 2023, Lukas Wunner wrote:

> On Fri, Sep 22, 2023 at 06:02:28AM +0200, Lukas Wunner wrote:
> > On Thu, Sep 21, 2023 at 06:01:41PM +0300, Ilpo Järvinen wrote:
> > > On Thu, 21 Sep 2023, Lukas Wunner wrote:
> > > > --- a/drivers/tty/serial/serial_core.c
> > > > +++ b/drivers/tty/serial/serial_core.c
> > > > @@ -1404,12 +1404,18 @@ static void uart_set_rs485_termination(struct uart_port *port,
> > > >  static int uart_rs485_config(struct uart_port *port)
> > > >  {
> > > >  	struct serial_rs485 *rs485 = &port->rs485;
> > > > +	unsigned long flags;
> > > >  	int ret;
> > > >  
> > > > +	if (!(rs485->flags & SER_RS485_ENABLED))
> > > > +		return 0;
> > > > +
> > > >  	uart_sanitize_serial_rs485(port, rs485);
> > > 
> > > There's a subtle change in behavior here, uart_sanitize_serial_rs485() 
> > > memset()s rs485 if RS485 is not enabled but the early return above does 
> > > not.
> > 
> > The two callers of uart_rs485_config() only call it if
> > (!(uport->rs485.flags & SER_RS485_ENABLED)).
> 
> I meant to say "if (uport->rs485.flags & SER_RS485_ENABLED)"
> (i.e. without negation).
> 
> Otherwise my point still stands. :)

Okay yeah, it's fine. I did not take the behavior under the old code into 
account well enough.

-- 
 i.

  reply	other threads:[~2023-09-22  9:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-21 14:52 [PATCH tty-linus] serial: Reduce spinlocked portion of uart_rs485_config() Lukas Wunner
2023-09-21 15:01 ` Ilpo Järvinen
2023-09-22  4:02   ` Lukas Wunner
2023-09-22  4:04     ` Lukas Wunner
2023-09-22  9:30       ` Ilpo Järvinen [this message]
2023-09-21 15:18 ` John Ogness
2023-09-21 15:23   ` Ilpo Järvinen
2023-09-22  4:23   ` Lukas Wunner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fd131a69-2cfb-7ff1-a3a5-44f591ca766@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=LinoSanfilippo@gmx.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=john.ogness@linutronix.de \
    --cc=linux-serial@vger.kernel.org \
    --cc=lukas@wunner.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).