Linux Serial subsystem development
 help / color / mirror / Atom feed
From: Fushuai Wang <fushuai.wang@linux.dev>
To: gregkh@linuxfoundation.org
Cc: andy.shevchenko@gmail.com, fushuai.wang@linux.dev,
	ilpo.jarvinen@linux.intel.com, jirislaby@kernel.org,
	kees@kernel.org, linux-kernel@vger.kernel.org,
	linux-serial@vger.kernel.org, osama.abdelkader@gmail.com,
	wangfushuai@baidu.com
Subject: Re: [PATCH v2] serial: 8250: Clear CON_PRINTBUFFER on port re-registration
Date: Fri, 22 May 2026 17:52:03 +0800	[thread overview]
Message-ID: <20260522095203.20796-1-fushuai.wang@linux.dev> (raw)
In-Reply-To: <2026052203-glutinous-smudge-91ab@gregkh>

>> >> --- a/drivers/tty/serial/8250/8250_core.c
>> >> +++ b/drivers/tty/serial/8250/8250_core.c
>> >> @@ -694,6 +694,7 @@ int serial8250_register_8250_port(const struct uart_8250_port *up)
>> >>  {
>> >>  	struct uart_8250_port *uart;
>> >>  	int ret;
>> >> +	bool was_removed = false;
>> >>  
>>> >>  	if (up->port.uartclk == 0)
>> >>  		return -EINVAL;
>> >> @@ -716,8 +717,10 @@ int serial8250_register_8250_port(const struct uart_8250_port *up)
>> >>  	if (uart->port.type == PORT_8250_CIR)
>> >>  		return -ENODEV;
>> >>  
>> >> -	if (uart->port.dev)
>> >> +	if (uart->port.dev) {
>> >>  		uart_remove_one_port(&serial8250_reg, &uart->port);
>> >> +		was_removed = true;
>> >> +	}
>> >>  
>> >>  	uart->port.ctrl_id	= up->port.ctrl_id;
>> >>  	uart->port.port_id	= up->port.port_id;
>> >> @@ -819,6 +822,10 @@ int serial8250_register_8250_port(const struct uart_8250_port *up)
>> >>  					&uart->capabilities);
>> >>  
>> >>  		serial8250_apply_quirks(uart);
>> >> +
>> >> +		if (was_removed && uart_console(&uart->port))
>> >> +			uart->port.cons->flags &= ~CON_PRINTBUFFER;
>> > 
>> > Why not set the flag up above when you remove the port?  Why down here?
>> > 
>> > thanks,
>> > 
>> > greg k-h
>> 
>> Hi, Greg
>> 
>> I just felt it's cleaner to clear it only when re-registration happens.
>> Do you think there is any problem with doing it right after the removal?
>
> If you do that, no flag is needed.

OK, I will send a v3 shortly.

-- 
Regards,
WANG

  reply	other threads:[~2026-05-22  9:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28  9:03 [PATCH v2] serial: 8250: Clear CON_PRINTBUFFER on port re-registration Fushuai Wang
2026-05-11 15:16 ` Greg KH
2026-05-15  7:44   ` Fushuai Wang
2026-05-22  9:44     ` Greg KH
2026-05-22  9:52       ` Fushuai Wang [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-04-28  8:58 Fushuai Wang

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=20260522095203.20796-1-fushuai.wang@linux.dev \
    --to=fushuai.wang@linux.dev \
    --cc=andy.shevchenko@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jirislaby@kernel.org \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=osama.abdelkader@gmail.com \
    --cc=wangfushuai@baidu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox