pci_find_class question

Tim Waugh (tim@cyberelk.demon.co.uk)
Sat, 31 Jul 1999 01:24:48 +0100 (GMT)


Hi,

Here's a patch that doesn't work as intended. The idea is to find all
'parallel communication' PCI cards, but that doesn't happen. The card I
have in this machine seems to have class
((PCI_CLASS_COMMUNICATION_PARALLEL << 8) | 2), and pci_find_class just
does a straight compare with no masking.

So I guess what I'm really asking is: what does the LSB byte in the class
mean?

Tim.
*/

--- drivers/parport/parport_pc.c~ Fri Jul 30 23:55:52 1999
+++ drivers/parport/parport_pc.c Sat Jul 31 01:21:48 1999
@@ -1746,6 +1746,7 @@
{ 0, }
};

+ struct pci_dev *pcidev;
int count = 0;
int i;

@@ -1753,7 +1754,7 @@
return 0;

for (i = 0; cards[i].vendor; i++) {
- struct pci_dev *pcidev = NULL;
+ pcidev = NULL;
while ((pcidev = pci_find_device (cards[i].vendor,
cards[i].device,
pcidev)) != NULL) {
@@ -1775,6 +1776,25 @@
irq, dma);
}
}
+ }
+
+ /* Look for parallel controllers that we don't know about. */
+ pcidev = NULL;
+ while ((pcidev = pci_find_class (PCI_CLASS_COMMUNICATION_PARALLEL << 8,
+ pcidev)) != NULL) {
+ for (i = 0; cards[i].vendor; i++)
+ if ((cards[i].vendor == pcidev->vendor) &&
+ (cards[i].device == pcidev->device))
+ break;
+ if (cards[i].vendor)
+ /* We know about this one. */
+ continue;
+
+ printk (KERN_INFO
+ "Unknown PCI parallel I/O card at %04x:%04x\n"
+ "Please send 'lspci' output to "
+ "tim@cyberelk.demon.co.uk\n",
+ pcidev->vendor, pcidev->device);
}

return count;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/