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

Add blacklisting capability to serial_pci to avoid misdetection of serial ports

The serial_pci driver tries to guess serial ports on unknown devices based
on the PCI class (modem or serial). On certain softmodems (AC'97 modems)
this can lead to the recognition of non-existing serial ports.

This patch adds a blacklist of PCI IDs that are to be ignored by the driver.

[akpm@linux-foundation.org: cleanups]
Signed-off-by: Christian Schmidt <schmidt@digadd.de>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Russell King <rmk+lkml@arm.linux.org.uk>
Cc: Yinghai Lu <yinghai.lu@sun.com>
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Christian Schmidt and committed by
Linus Torvalds
436bbd43 ad4c2aa6

+17
+17
drivers/serial/8250_pci.c
··· 1652 1652 }, 1653 1653 }; 1654 1654 1655 + static const struct pci_device_id softmodem_blacklist[] = { 1656 + { PCI_VDEVICE ( AL, 0x5457 ), }, /* ALi Corporation M5457 AC'97 Modem */ 1657 + }; 1658 + 1655 1659 /* 1656 1660 * Given a complete unknown PCI device, try to use some heuristics to 1657 1661 * guess what the configuration might be, based on the pitiful PCI ··· 1664 1660 static int __devinit 1665 1661 serial_pci_guess_board(struct pci_dev *dev, struct pciserial_board *board) 1666 1662 { 1663 + const struct pci_device_id *blacklist; 1667 1664 int num_iomem, num_port, first_port = -1, i; 1668 1665 1669 1666 /* ··· 1678 1673 ((dev->class >> 8) != PCI_CLASS_COMMUNICATION_MODEM)) || 1679 1674 (dev->class & 0xff) > 6) 1680 1675 return -ENODEV; 1676 + 1677 + /* 1678 + * Do not access blacklisted devices that are known not to 1679 + * feature serial ports. 1680 + */ 1681 + for (blacklist = softmodem_blacklist; 1682 + blacklist < softmodem_blacklist + ARRAY_SIZE(softmodem_blacklist); 1683 + blacklist++) { 1684 + if (dev->vendor == blacklist->vendor && 1685 + dev->device == blacklist->device) 1686 + return -ENODEV; 1687 + } 1681 1688 1682 1689 num_iomem = num_port = 0; 1683 1690 for (i = 0; i < PCI_NUM_BAR_RESOURCES; i++) {