On Mon, Nov 07, 2022 at 06:15:15PM +0530, Kumaravel Thiagarajan wrote: > +++ b/drivers/tty/serial/8250/8250_pcilib.c > @@ -0,0 +1,31 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* Microchip pci1xxxx 8250 library. */ Better name and a copyright line? > + > +#include <linux/pci.h> > +#include "8250.h" > + > +int pci_setup_port(struct pci_dev *dev, struct uart_8250_port *port, > + u8 bar, unsigned int offset, int regshift) > +{ > + if (bar >= PCI_STD_NUM_BARS) > + return -EINVAL; > + > + if (pci_resource_flags(dev, bar) & IORESOURCE_MEM) { > + if (!pcim_iomap(dev, bar, 0) && !pcim_iomap_table(dev)) > + return -ENOMEM; > + > + port->port.iotype = UPIO_MEM; > + port->port.iobase = 0; > + port->port.mapbase = pci_resource_start(dev, bar) + offset; > + port->port.membase = pcim_iomap_table(dev)[bar] + offset; > + port->port.regshift = regshift; > + } else { > + port->port.iotype = UPIO_PORT; > + port->port.iobase = pci_resource_start(dev, bar) + offset; > + port->port.mapbase = 0; > + port->port.membase = NULL; > + port->port.regshift = 0; > + } > + return 0; > +} > +EXPORT_SYMBOL_GPL(pci_setup_port); This needs a better name, 8250_pci_setup_port()? This is not a pci core function. thanks, greg k-h