Bug#335665: kudzu patch to not use PCI_FILL_CLASS

Matthew Wilcox <[email protected]> Tue, 13 Jun 2006 10:36:33 -0600
Newsgroups gmane.linux.debian.devel.bugs.general,gmane.linux.redhat.devel
Message-ID <[email protected]>
PCI_FILL_CLASS is a RH specific patch to pciutils that upstream isn't
interested in.  This patch removes uses of that feature from kudzu which
allows current CVS to compile on a system without RH patches to pciutils.

By the way, the main kudzu page at http://rhlinux.redhat.com/kudzu/
has two broken links on it; the "rawhide" link and the "cvsweb" link.

Index: pci.c
===================================================================
RCS file: /usr/local/CVS/kudzu/pci.c,v
retrieving revision 1.140
diff -u -p -r1.140 pci.c
--- pci.c	28 Feb 2006 19:49:56 -0000	1.140
+++ pci.c	13 Jun 2006 16:25:57 -0000
@@ -286,7 +286,7 @@ static int isDisabled(struct pci_dev *p,
 #endif	
 	unsigned int devtype, command;
 	
-	devtype = p->device_class;
+	devtype = pci_read_word(p, PCI_CLASS_DEVICE);
 	if (p->irq || pciToKudzu(devtype) != CLASS_VIDEO) {
 		return 0;
 	}
@@ -416,7 +416,7 @@ struct device * pciProbe(enum deviceClas
 		    subvend = config[PCI_SUBSYSTEM_VENDOR_ID+1] << 8 | config[PCI_SUBSYSTEM_VENDOR_ID];
 		    subdev = config[PCI_SUBSYSTEM_ID+1] << 8 | config[PCI_SUBSYSTEM_ID];
 		}
-		pci_fill_info(p, PCI_FILL_IDENT | PCI_FILL_CLASS | PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE | PCI_FILL_SIZES);
+		pci_fill_info(p, PCI_FILL_IDENT | PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE | PCI_FILL_SIZES);
 		bustype = PCI_NORMAL;
 	        for (bridgenum=0; cardbus_bridges[bridgenum]; bridgenum++) {
 			if (p->bus == cardbus_bridges[bridgenum])
@@ -428,14 +428,14 @@ struct device * pciProbe(enum deviceClas
 		dev->subVendorId = subvend;
 		dev->subDeviceId = subdev;
 		dev->pciType = bustype;
+		devtype = pci_read_word(p, PCI_CLASS_DEVICE);
 		asprintf(&t,"v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x",p->vendor_id,p->device_id,
-			 subvend, subdev,(u_int8_t)(p->device_class >> 8),(u_int8_t)(p->device_class),config[PCI_CLASS_PROG]);
+			 subvend, subdev, devtype >> 8, devtype & 0xff, config[PCI_CLASS_PROG]);
 		drv = aliasSearch(aliases, "pci", t);
 		x_drv = aliasSearch(aliases, "pcivideo", t);
 		free(t);
 		if (drv)
 			dev->driver = strdup(drv);
-		devtype = p->device_class;
 		if (x_drv) {
 			dev->classprivate = strdup(x_drv);
 		}