Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

serial: 8250_pcilib: Replace deprecated PCI functions

When the '8250_exar' module is loaded into the kernel, a kernel trace
with 'WARN_ON(legacy_iomap_table[bar])' is dumped to the console,
because the old pci table mapping is still used in '8250_pcilib'.

The old function have been deprecated in commit e354bb84a4c1 ("PCI:
Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all()").

The remapping already takes or must take place in the driver that calls
the function 'serial8250_pci_setup_port()'. The remapping should only be
called once via 'pcim_iomap()'. Therefore the remapping moved to the
caller of 'serial8250_pci_setup_port()'.

To replace the outdated/legacy iomap_table processing in '8250_pcilib' the
function signature of 'serial8250_pci_setup_port()' has been extended with
an already iomapped address value. So this can be used directly without
io mapping again.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Link: https://patch.msgid.link/20250930072743.791580-1-fe@dev.tdt.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Florian Eckert and committed by
Greg Kroah-Hartman
b7cefdb6 0cfadf4b

+19 -14
+2 -2
drivers/tty/serial/8250/8250_exar.c
··· 503 503 unsigned char status; 504 504 int err; 505 505 506 - err = serial8250_pci_setup_port(pcidev, port, 0, offset, board->reg_shift); 506 + err = serial8250_pci_setup_port(pcidev, port, 0, offset, board->reg_shift, priv->virt); 507 507 if (err) 508 508 return err; 509 509 ··· 831 831 port->port.port_id = idx; 832 832 port->port.uartclk = priv->osc_freq; 833 833 834 - ret = serial8250_pci_setup_port(pcidev, port, 0, offset, 0); 834 + ret = serial8250_pci_setup_port(pcidev, port, 0, offset, 0, priv->virt); 835 835 if (ret) 836 836 return ret; 837 837
+9 -1
drivers/tty/serial/8250/8250_pci.c
··· 165 165 setup_port(struct serial_private *priv, struct uart_8250_port *port, 166 166 u8 bar, unsigned int offset, int regshift) 167 167 { 168 - return serial8250_pci_setup_port(priv->dev, port, bar, offset, regshift); 168 + void __iomem *iomem = NULL; 169 + 170 + if (pci_resource_flags(priv->dev, bar) & IORESOURCE_MEM) { 171 + iomem = pcim_iomap(priv->dev, bar, 0); 172 + if (!iomem) 173 + return -ENOMEM; 174 + } 175 + 176 + return serial8250_pci_setup_port(priv->dev, port, bar, offset, regshift, iomem); 169 177 } 170 178 171 179 /*
+5 -5
drivers/tty/serial/8250/8250_pci1xxxx.c
··· 671 671 } 672 672 673 673 static int pci1xxxx_setup(struct pci_dev *pdev, 674 - struct uart_8250_port *port, int port_idx, int rev) 674 + struct uart_8250_port *port, int port_idx, struct pci1xxxx_8250 *priv) 675 675 { 676 676 int ret; 677 677 ··· 698 698 * C0 and later revisions support Burst operation. 699 699 * RTS workaround in mctrl is applicable only to B0. 700 700 */ 701 - if (rev >= 0xC0) 701 + if (priv->dev_rev >= 0xC0) 702 702 port->port.handle_irq = pci1xxxx_handle_irq; 703 - else if (rev == 0xB0) 703 + else if (priv->dev_rev == 0xB0) 704 704 port->port.set_mctrl = pci1xxxx_set_mctrl; 705 705 706 - ret = serial8250_pci_setup_port(pdev, port, 0, PORT_OFFSET * port_idx, 0); 706 + ret = serial8250_pci_setup_port(pdev, port, 0, PORT_OFFSET * port_idx, 0, priv->membase); 707 707 if (ret < 0) 708 708 return ret; 709 709 ··· 821 821 else 822 822 uart.port.irq = pci_irq_vector(pdev, 0); 823 823 824 - rc = pci1xxxx_setup(pdev, &uart, port_idx, priv->dev_rev); 824 + rc = pci1xxxx_setup(pdev, &uart, port_idx, priv); 825 825 if (rc) { 826 826 dev_warn(dev, "Failed to setup port %u\n", i); 827 827 continue;
+2 -5
drivers/tty/serial/8250/8250_pcilib.c
··· 22 22 EXPORT_SYMBOL_NS_GPL(serial_8250_warn_need_ioport, "SERIAL_8250_PCI"); 23 23 24 24 int serial8250_pci_setup_port(struct pci_dev *dev, struct uart_8250_port *port, 25 - u8 bar, unsigned int offset, int regshift) 25 + u8 bar, unsigned int offset, int regshift, void __iomem *iomem) 26 26 { 27 27 if (bar >= PCI_STD_NUM_BARS) 28 28 return -EINVAL; 29 29 30 30 if (pci_resource_flags(dev, bar) & IORESOURCE_MEM) { 31 - if (!pcim_iomap(dev, bar, 0) && !pcim_iomap_table(dev)) 32 - return -ENOMEM; 33 - 34 31 port->port.iotype = UPIO_MEM; 35 32 port->port.iobase = 0; 36 33 port->port.mapbase = pci_resource_start(dev, bar) + offset; 37 - port->port.membase = pcim_iomap_table(dev)[bar] + offset; 34 + port->port.membase = iomem + offset; 38 35 port->port.regshift = regshift; 39 36 } else if (IS_ENABLED(CONFIG_HAS_IOPORT)) { 40 37 port->port.iotype = UPIO_PORT;
+1 -1
drivers/tty/serial/8250/8250_pcilib.h
··· 12 12 struct uart_8250_port; 13 13 14 14 int serial8250_pci_setup_port(struct pci_dev *dev, struct uart_8250_port *port, u8 bar, 15 - unsigned int offset, int regshift); 15 + unsigned int offset, int regshift, void __iomem *iomem); 16 16 17 17 int serial_8250_warn_need_ioport(struct pci_dev *dev);