public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
From: Hugo Villeneuve <hugo@hugovil.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-serial <linux-serial@vger.kernel.org>,
	Hugo Villeneuve <hvilleneuve@dimonoff.com>
Subject: Re: [PATCH 6/9] serial: core: prevent irrelevant I/O infos display for UPIO_BUS
Date: Fri, 24 Apr 2026 10:24:55 -0400	[thread overview]
Message-ID: <20260424102455.9f1c60ba937c6899bc1b9056@hugovil.com> (raw)
In-Reply-To: <96429741-16d0-3e4b-b42f-d273a2adfba7@linux.intel.com>

On Fri, 24 Apr 2026 13:51:52 +0300 (EEST)
Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> wrote:

> On Thu, 23 Apr 2026, Hugo Villeneuve wrote:
> 
> > From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> > 
> > It doesn't make sense to display irrelevant MMIO or legacy I/O information
> > for serial devices on I2C or SPI busses. Now that we have a separate I/O
> > type for these types of devices, prevent display of I/O information for
> > them. Using uart_iotype_*() functions to do so also addresses the now
> > invalid check for "iotype >= UPIO_MEM".
> > 
> > Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> > ---
> >  drivers/tty/serial/serial_core.c | 50 ++++++++++++++++++----------------------
> >  1 file changed, 22 insertions(+), 28 deletions(-)
> > 
> > diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> > index 0bfdb69817e4259681fbc4658c9a68200aa2b65f..42559eda6fc134de77c3a7b850d565ebdc89e216 100644
> > --- a/drivers/tty/serial/serial_core.c
> > +++ b/drivers/tty/serial/serial_core.c
> > @@ -2011,13 +2011,18 @@ static void uart_line_info(struct seq_file *m, struct uart_state *state)
> >  	if (!uport)
> >  		return;
> >  
> > -	mmio = uport->iotype >= UPIO_MEM;
> > -	seq_printf(m, "%u: uart:%s %s%08llX irq:%u",
> > -			uport->line, uart_type(uport),
> > -			mmio ? "mmio:0x" : "port:",
> > -			mmio ? (unsigned long long)uport->mapbase
> > -			     : (unsigned long long)uport->iobase,
> > -			uport->irq);
> > +	seq_printf(m, "%u: uart:%s", uport->line, uart_type(uport));
> > +
> > +	mmio = uart_iotype_mmio(uport->iotype);
> > +
> > +	if (mmio || uart_iotype_legacy_io(uport->iotype)) {
> > +		seq_printf(m, " %s%08llX",
> > +			   mmio ? "mmio:0x" : "port:",
> > +			   mmio ? (unsigned long long)uport->mapbase
> > +			   : (unsigned long long)uport->iobase);
> 
> This should align to ?

Ok, my auto-indent is not working for that.

Will change it to:
    seq_printf(m, " %s%08llX", mmio ? "mmio:0x" : "port:",
               mmio ? (unsigned long long)uport->mapbase
                    : (unsigned long long)uport->iobase);

> 
> > +	}
> > +
> > +	seq_printf(m, "irq:%u", uport->irq);
> >  
> >  	if (uport->type == PORT_UNKNOWN) {
> >  		seq_putc(m, '\n');
> > @@ -2482,31 +2487,20 @@ EXPORT_SYMBOL(uart_resume_port);
> >  static inline void
> >  uart_report_port(struct uart_driver *drv, struct uart_port *port)
> >  {
> > -	char address[64];
> > +	char address[64] = "";
> >  
> > -	switch (port->iotype) {
> > -	case UPIO_PORT:
> > -		snprintf(address, sizeof(address), "I/O 0x%lx", port->iobase);
> > -		break;
> > -	case UPIO_HUB6:
> > +	if (uart_iotype_mmio(port->iotype))
> >  		snprintf(address, sizeof(address),
> > -			 "I/O 0x%lx offset 0x%x", port->iobase, port->hub6);
> > -		break;
> > -	case UPIO_MEM:
> > -	case UPIO_MEM16:
> > -	case UPIO_MEM32:
> > -	case UPIO_MEM32BE:
> > -	case UPIO_AU:
> > -	case UPIO_TSI:
> > -		snprintf(address, sizeof(address),
> > -			 "MMIO 0x%llx", (unsigned long long)port->mapbase);
> > -		break;
> > -	default:
> > -		strscpy(address, "*unknown*", sizeof(address));
> > -		break;
> > +			 " at MMIO 0x%llx", (unsigned long long)port->mapbase);
> > +	else if (uart_iotype_legacy_io(port->iotype)) {
> > +		if (port->iotype == UPIO_PORT)
> > +			snprintf(address, sizeof(address), " at I/O 0x%lx", port->iobase);
> > +		else if (port->iotype == UPIO_HUB6)
> > +			snprintf(address, sizeof(address),
> > +				 " at I/O 0x%lx offset 0x%x", port->iobase, port->hub6);
> 
> Please use scnprintf() so we could perhaps one day get rid of snprintf() 
> entirely.

Ok will do.

> 
> >  	}
> >  
> > -	pr_info("%s%s%s at %s (irq = %u, base_baud = %u) is a %s\n",
> > +	pr_info("%s%s%s%s (irq = %u, base_baud = %u) is a %s\n",
> >  		port->dev ? dev_name(port->dev) : "",
> >  		port->dev ? ": " : "",
> >  		port->name,
> > 
> > 
> 
> -- 
>  i.
> 
> 


-- 
Hugo Villeneuve

  reply	other threads:[~2026-04-24 14:24 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-23 20:15 [PATCH 0/9] serial: add new I/O type for SPI and I2C bus devices Hugo Villeneuve
2026-04-23 20:15 ` [PATCH 1/9] serial: core: add uart_iotype_mmio/legacy_io helper functions Hugo Villeneuve
2026-04-23 20:15 ` [PATCH 2/9] serial: core: use uart_iotype_*() to simplify code Hugo Villeneuve
2026-04-24 11:13   ` Ilpo Järvinen
2026-04-24 15:30     ` Hugo Villeneuve
2026-04-27 13:46       ` Hugo Villeneuve
2026-04-27 14:16         ` Ilpo Järvinen
2026-04-27 14:18           ` Hugo Villeneuve
2026-04-23 20:15 ` [PATCH 3/9] serial: 8250: " Hugo Villeneuve
2026-04-23 20:15 ` [PATCH 4/9] serial: core: fix indentation/alignment Hugo Villeneuve
2026-04-23 20:15 ` [PATCH 5/9] serial: core: add new I/O type for SPI and I2C bus devices Hugo Villeneuve
2026-04-23 20:15 ` [PATCH 6/9] serial: core: prevent irrelevant I/O infos display for UPIO_BUS Hugo Villeneuve
2026-04-24 10:51   ` Ilpo Järvinen
2026-04-24 14:24     ` Hugo Villeneuve [this message]
2026-04-23 20:15 ` [PATCH 7/9] serial: sc16is7xx: use new UPIO_BUS as iotype Hugo Villeneuve
2026-04-23 20:15 ` [PATCH 8/9] serial: max310x: " Hugo Villeneuve
2026-04-23 20:15 ` [PATCH 9/9] serial: max3100: " Hugo Villeneuve
2026-04-24 11:24 ` [PATCH 0/9] serial: add new I/O type for SPI and I2C bus devices Ilpo Järvinen

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=20260424102455.9f1c60ba937c6899bc1b9056@hugovil.com \
    --to=hugo@hugovil.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hvilleneuve@dimonoff.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /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