public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] Add blacklisting capability to serial_pci to avoid misdetection of serial ports
@ 2007-07-05 22:18 Christian P. Schmidt
  0 siblings, 0 replies; only message in thread
From: Christian P. Schmidt @ 2007-07-05 22:18 UTC (permalink / raw)
  To: linux-kernel

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

From: Christian Schmidt <schmidt@digadd.de>

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.

The patch applies against both 2.6.21.5 and 2.6.22-rc7.

Signed-off-by: Christian Schmidt <schmidt@digadd.de>


[-- Attachment #2: 8250_pci.blacklist.patch --]
[-- Type: text/plain, Size: 1240 bytes --]

--- linux-2.6.21.5.orig/drivers/serial/8250_pci.c	2007-04-26 06:08:32.000000000 +0300
+++ linux-2.6.21.5/drivers/serial/8250_pci.c	2007-07-05 17:26:32.000000000 +0300
@@ -1513,6 +1513,11 @@
 	},
 };
 
+static const struct pci_device_id softmodem_blacklist[] = {
+     { PCI_VDEVICE ( AL, 0x5457 ), }, /* ALi Corporation M5457 AC'97 Modem */
+     { }
+};
+
 /*
  * Given a complete unknown PCI device, try to use some heuristics to
  * guess what the configuration might be, based on the pitiful PCI
@@ -1521,6 +1526,7 @@
 static int __devinit
 serial_pci_guess_board(struct pci_dev *dev, struct pciserial_board *board)
 {
+        const struct pci_device_id * blacklist;
 	int num_iomem, num_port, first_port = -1, i;
 	
 	/*
@@ -1535,6 +1541,16 @@
 	    (dev->class & 0xff) > 6)
 		return -ENODEV;
 
+	/*
+	 * Do not access blacklisted devices that are known not to
+	 * feature serial ports.
+	 */
+	for (blacklist = softmodem_blacklist; blacklist->vendor; blacklist++) {
+	        if ((dev->vendor == blacklist->vendor) &&
+	            (dev->device == blacklist->device))
+		        return -ENODEV;
+	}
+	
 	num_iomem = num_port = 0;
 	for (i = 0; i < PCI_NUM_BAR_RESOURCES; i++) {
 		if (pci_resource_flags(dev, i) & IORESOURCE_IO) {

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-07-05 22:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-05 22:18 [patch] Add blacklisting capability to serial_pci to avoid misdetection of serial ports Christian P. Schmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox