From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Tony Lindgren <tony@atomide.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
linux-serial@vger.kernel.org
Subject: Re: [PATCH] serial: core: Fix missing shutdown and startup for serial base port
Date: Thu, 11 Apr 2024 16:06:01 +0300 [thread overview]
Message-ID: <ZhfgOU7htReGK3Xt@smile.fi.intel.com> (raw)
In-Reply-To: <20240411055848.38190-1-tony@atomide.com>
On Thu, Apr 11, 2024 at 08:58:45AM +0300, Tony Lindgren wrote:
> We are seeing start_tx being called after port shutdown as noted by Jiri.
> This happens because we are missing the startup and shutdown related
> functions for the serial base port.
>
> Let's fix the issue by adding startup and shutdown functions for the
> serial base port to block tx flushing for the serial base port when the
> port is not in use.
I'm going to test this later today, meanwhile some comments below.
...
> +out_base_port_startup:
> + uport = uart_port_check(state);
> + if (!uport)
> + return -EIO;
> +
> + serial_base_port_startup(uport);
So, we call this even on uninitialised TTY. Is it okay?
> + return 0;
> }
...
> if (tty)
> set_bit(TTY_IO_ERROR, &tty->flags);
> + if (uport)
> + serial_base_port_shutdown(uport);
Why not to call it after the below check to be reverse-symmetrical with startup?
> if (tty_port_initialized(port)) {
> tty_port_set_initialized(port, false);
>
...
> /* Flush any pending TX for the port */
> uart_port_lock_irqsave(port, &flags);
> + if (!port_dev->tx_enabled)
> + goto unlock;
Can't this be integrated into...
> if (__serial_port_busy(port))
...this call?
> port->ops->start_tx(port);
> +
> +unlock:
> uart_port_unlock_irqrestore(port, flags);
>
...
> uart_port_lock_irqsave(port, &flags);
> + if (!port_dev->tx_enabled) {
> + uart_port_unlock_irqrestore(port, flags);
> + return 0;
> + }
> +
> busy = __serial_port_busy(port);
> if (busy)
> port->ops->start_tx(port);
Ditto.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2024-04-11 13:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-11 5:58 [PATCH] serial: core: Fix missing shutdown and startup for serial base port Tony Lindgren
2024-04-11 13:06 ` Andy Shevchenko [this message]
2024-04-12 3:45 ` Tony Lindgren
2024-04-11 14:53 ` Andy Shevchenko
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=ZhfgOU7htReGK3Xt@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=tony@atomide.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.