Re: [PATCH v2 2/8] serial: txx9: Simplify knowing that .iotype is always UPIO_PORT

Atsushi Nemoto <[email protected]> Tue, 04 Aug 2026 23:05:36 +0900 (JST)
Newsgroups gmane.linux.serial,gmane.linux.kernel
Message-ID <[email protected]>
On Tue,  4 Aug 2026 10:57:54 +0200, Uwe Kleine-K=F6nig (The Capable Hub=
) <[email protected]> wrote:
> After the previous commit it's obvious that .iotype is always UPIO_PO=
RT.
> Simplify some functions accordingly.

No, .iotype can be UPIO_MEM if early_serial_txx9_setup() was called fro=
m
arch/mips/txx9/generic/setup.c.

Please drop this patch from your series.

---
Atsushi Nemoto

On Tue,  4 Aug 2026 10:57:54 +0200, Uwe Kleine-K=F6nig (The Capable Hub=
) <[email protected]> wrote:
> After the previous commit it's obvious that .iotype is always UPIO_PO=
RT.
> Simplify some functions accordingly.
> =

> Suggested-by: Ilpo J=E4rvinen <[email protected]>
> Link: https://lore.kernel.org/linux-serial/01a84877-9cc7-8136-d5a8-e3=
[email protected]
> Signed-off-by: Uwe Kleine-K=F6nig (The Capable Hub) <u.kleine-koenig@=
baylibre.com>
> ---
>  drivers/tty/serial/serial_txx9.c | 69 ++++--------------------------=
--
>  1 file changed, 7 insertions(+), 62 deletions(-)
> =

> diff --git a/drivers/tty/serial/serial_txx9.c b/drivers/tty/serial/se=
rial_txx9.c
> index ef56979321b9..bda7f7527b8d 100644
> --- a/drivers/tty/serial/serial_txx9.c
> +++ b/drivers/tty/serial/serial_txx9.c
> @@ -158,25 +158,13 @@
>  =

>  static inline unsigned int sio_in(struct uart_port *up, int offset)
>  {
> -	switch (up->iotype) {
> -	default:
> -		return __raw_readl(up->membase + offset);
> -	case UPIO_PORT:
> -		return inl(up->iobase + offset);
> -	}
> +	return inl(up->iobase + offset);
>  }
>  =

>  static inline void
>  sio_out(struct uart_port *up, int offset, int value)
>  {
> -	switch (up->iotype) {
> -	default:
> -		__raw_writel(value, up->membase + offset);
> -		break;
> -	case UPIO_PORT:
> -		outl(value, up->iobase + offset);
> -		break;
> -	}
> +	outl(value, up->iobase + offset);
>  }
>  =

>  static inline void
> @@ -698,57 +686,15 @@ serial_txx9_pm(struct uart_port *port, unsigned=
 int state,
>  =

>  static int serial_txx9_request_resource(struct uart_port *up)
>  {
> -	unsigned int size =3D TXX9_REGION_SIZE;
> -	int ret =3D 0;
> +	if (!request_region(up->iobase, TXX9_REGION_SIZE, "serial_txx9"))
> +		return -EBUSY;
>  =

> -	switch (up->iotype) {
> -	default:
> -		if (!up->mapbase)
> -			break;
> -
> -		if (!request_mem_region(up->mapbase, size, "serial_txx9")) {
> -			ret =3D -EBUSY;
> -			break;
> -		}
> -
> -		if (up->flags & UPF_IOREMAP) {
> -			up->membase =3D ioremap(up->mapbase, size);
> -			if (!up->membase) {
> -				release_mem_region(up->mapbase, size);
> -				ret =3D -ENOMEM;
> -			}
> -		}
> -		break;
> -
> -	case UPIO_PORT:
> -		if (!request_region(up->iobase, size, "serial_txx9"))
> -			ret =3D -EBUSY;
> -		break;
> -	}
> -	return ret;
> +	return 0;
>  }
>  =

>  static void serial_txx9_release_resource(struct uart_port *up)
>  {
> -	unsigned int size =3D TXX9_REGION_SIZE;
> -
> -	switch (up->iotype) {
> -	default:
> -		if (!up->mapbase)
> -			break;
> -
> -		if (up->flags & UPF_IOREMAP) {
> -			iounmap(up->membase);
> -			up->membase =3D NULL;
> -		}
> -
> -		release_mem_region(up->mapbase, size);
> -		break;
> -
> -	case UPIO_PORT:
> -		release_region(up->iobase, size);
> -		break;
> -	}
> +	release_region(up->iobase, TXX9_REGION_SIZE);
>  }
>  =

>  static void serial_txx9_release_port(struct uart_port *up)
> @@ -983,7 +929,7 @@ static int serial_txx9_register_port(struct uart_=
port *port)
>  		uart->membase =3D port->membase;
>  		uart->irq      =3D port->irq;
>  		uart->uartclk  =3D port->uartclk;
> -		uart->iotype   =3D port->iotype;
> +		uart->iotype   =3D UPIO_PORT;
>  		uart->flags    =3D port->flags
>  			| UPF_BOOT_AUTOCONF | UPF_FIXED_PORT;
>  		uart->mapbase  =3D port->mapbase;
> @@ -1081,7 +1027,6 @@ pciserial_txx9_init_one(struct pci_dev *dev, co=
nst struct pci_device_id *ent)
>  	port.flags |=3D UPF_TXX9_HAVE_CTS_LINE;
>  	port.uartclk =3D 66670000;
>  	port.irq =3D dev->irq;
> -	port.iotype =3D UPIO_PORT;
>  	port.iobase =3D pci_resource_start(dev, 1);
>  	port.dev =3D &dev->dev;
>  	line =3D serial_txx9_register_port(&port);
> -- =

> 2.55.0.11.g153666a7d9bb
> =

> =