public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Hugo Villeneuve <hugo@hugovil.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 2/9] serial: core: use uart_iotype_*() to simplify code
Date: Mon, 27 Apr 2026 17:16:11 +0300 (EEST)	[thread overview]
Message-ID: <abe6c6b3-7e9a-b9bc-80e9-2f5294f2095c@linux.intel.com> (raw)
In-Reply-To: <20260427094639.73a7e27709e466fda2356a4d@hugovil.com>

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

On Mon, 27 Apr 2026, Hugo Villeneuve wrote:

> On Fri, 24 Apr 2026 11:30:46 -0400
> Hugo Villeneuve <hugo@hugovil.com> wrote:
> 
> > On Fri, 24 Apr 2026 14:13:02 +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>
> > > > 
> > > > Make use of new functions uart_iotype_mmio() and uart_iotype_legacy_io()
> > > > to simplify and improve code readability.
> > > > 
> > > > Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> > > > ---
> > > >  drivers/tty/serial/serial_core.c | 24 +++++++++---------------
> > > >  1 file changed, 9 insertions(+), 15 deletions(-)
> > > > 
> > > > diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> > > > index b1cf45a8fc854cd97e349ff077d83b42e3ef8b16..fc273f8f9e75de89dca1ac1aca3589567bcf8a18 100644
> > > > --- a/drivers/tty/serial/serial_core.c
> > > > +++ b/drivers/tty/serial/serial_core.c
> > > > @@ -3221,23 +3221,17 @@ bool uart_match_port(const struct uart_port *port1,
> > > >  {
> > > >  	if (port1->iotype != port2->iotype)
> > > >  		return false;
> > > > -
> > > > -	switch (port1->iotype) {
> > > > -	case UPIO_PORT:
> > > > -		return port1->iobase == port2->iobase;
> > > > -	case UPIO_HUB6:
> > > > -		return port1->iobase == port2->iobase &&
> > > > -		       port1->hub6   == port2->hub6;
> > > > -	case UPIO_MEM:
> > > > -	case UPIO_MEM16:
> > > > -	case UPIO_MEM32:
> > > > -	case UPIO_MEM32BE:
> > > > -	case UPIO_AU:
> > > > -	case UPIO_TSI:
> > > > +	else if (uart_iotype_mmio(port1->iotype))
> > > >  		return port1->mapbase == port2->mapbase;
> > > > -	default:
> > > > +	else if (uart_iotype_legacy_io(port1->iotype))
> > > > +		if (port1->iobase != port2->iobase)
> > > > +			return false;
> > > > +		else if (port1->iotype == UPIO_HUB6 && port1->hub6 != port2->hub6)
> > > 
> > > I suggest placing the entire hub6 related check (including the iobase 
> > > check) into own function in 8250_hub6.c and add a stub for the case when 
> > > hub6 code is not even built into kernel into 8250.h.
> > 
> > Neat. I will make a separate commit for that in V2. This
> > simplifies uart_match_port() even more...
> 
> I implemented it, the only thing I am not sure about is the include of
> "8250/8250.h" in serial_core.c?

I'd just include it and add comment before it that it's included because 
of UPIO_HUB6 port matching.

The more generic alternative would be to make the matcher a callback but 
that feels overkill for some legacy iotype trick, IMO.

-- 
 i.

  reply	other threads:[~2026-04-27 14:16 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 [this message]
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
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=abe6c6b3-7e9a-b9bc-80e9-2f5294f2095c@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hugo@hugovil.com \
    --cc=hvilleneuve@dimonoff.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