[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-kernel
Subject:    Re: latest 2.1.11* with de4x5 and multiple Tulips
From:       "David C. Davies" <davies () ultranet ! com>
Date:       1998-07-31 22:59:28
[Download RAW message or body]

All,

Sorry for the delay in replying - been on vacation.

The enclosed diff should patch the 0.540 driver to work correctly. It
tested fine with 2 cards here.

Let me know if this is OK and I'll send the final version to Linus.

Regards,

Dave

--------------------------------

The Rich Tapestry of Life is Fraying . . .
["de4x5-05401.diff" (text/plain)]

--- de4x5-0.540.c	Thu Jul 30 18:14:06 1998
+++ de4x5.c	Fri Jul 31 18:39:34 1998
@@ -399,11 +399,16 @@
 			   from report & fix by <paubert@iram.es>.
 			  Fix probe bug with EISA & PCI cards present from
                            report by <eirik@netcom.com>.
+      0.541  ??-Aug-98    Fix compiler problems associated with i386-string
+                           ops from multiple bug reports and temporary fix
+			   from <paubert@iram.es>.
+			  Fix pci_probe() to correctly emulate the old
+			   pcibios_find_class() function.
 
     =========================================================================
 */
 
-static const char *version = "de4x5.c:V0.540 1998/7/5 davies@maniac.ultranet.com\n";
+static const char *version = "de4x5.c:T0.5401 1998/7/31 davies@maniac.ultranet.com\n";
 
 #include <linux/config.h>
 #include <linux/module.h>
@@ -958,7 +963,8 @@
 static void    eisa_probe(struct device *dev, u_long iobase);
 #endif
 static void    pci_probe(struct device *dev, u_long iobase);
-static void    srom_search(struct pci_dev *pdev);
+static void    srom_search(int index);
+static struct pci_dev *de4x5_find_class(u_int class, u_short index);
 static char    *build_setup_frame(struct device *dev, int mode);
 static void    disable_ast(struct device *dev);
 static void    enable_ast(struct device *dev, u32 time_out);
@@ -2103,7 +2109,7 @@
     u_int irq = 0, device, class = DE4X5_CLASS_CODE;
     u_long iobase = 0;                     /* Clear upper 32 bits in Alphas */
     struct bus_type *lp = &bus;
-    struct pci_dev *pdev = NULL;
+    struct pci_dev *pdev;
 
     if (lastPCI == NO_MORE_PCI) return;
 
@@ -2123,7 +2129,7 @@
 	dnum = 0;
     }
 
-    for (index=lastPCI+1; (pdev=pci_find_class(class, pdev))!=NULL; index++) {
+    for (index=lastPCI+1;(pdev=de4x5_find_class(class, index))!=NULL;index++) {
 	dev_num = PCI_SLOT(pdev->devfn);
 	pb = pdev->bus->number;
 	if ((pbus || dnum) && ((pbus != pb) || (dnum != dev_num))) continue;
@@ -2135,7 +2141,7 @@
 	/* Search for an SROM on this bus */
 	if (lp->bus_num != pb) {
 	    lp->bus_num = pb;
-	    srom_search(pdev);
+	    srom_search(index);
 	}
 
 	/* Get the chip configuration revision register */
@@ -2209,7 +2215,7 @@
 ** For single port cards this is a time waster...
 */
 __initfunc(static void
-srom_search(struct pci_dev *pdev))
+srom_search(int index))
 {
     u_char pb;
     u_short vendor, status;
@@ -2217,8 +2223,9 @@
     u_long iobase = 0;                     /* Clear upper 32 bits in Alphas */
     int i, j;
     struct bus_type *lp = &bus;
+    struct pci_dev *pdev;
 
-    while ((pdev = pci_find_class(class, pdev))!= NULL) {
+    for (; (pdev=de4x5_find_class(class, index))!= NULL; index++) {
 	if (lp->bus_num != pdev->bus->number) return;
 	pb = pdev->bus->number;
 	vendor = pdev->vendor;
@@ -2266,6 +2273,21 @@
     return;
 }
 
+__initfunc(static struct pci_dev *
+de4x5_find_class(u_int class, u_short index))
+{
+    struct pci_dev *dev = NULL;
+    int cnt = 0;
+
+    while ((dev = pci_find_class(class, dev))) {
+	if (index == cnt++) {
+	    return dev;
+	}
+    }
+
+    return NULL;
+}
+
 __initfunc(static void
 link_modules(struct device *dev, struct device *tmp))
 {
@@ -3898,7 +3920,7 @@
 static int
 EISA_signature(char *name, s32 eisa_id)
 {
-    c_char *signatures[] = DE4X5_SIGNATURE;
+    static c_char *signatures[] = DE4X5_SIGNATURE;
     char ManCode[DE4X5_STRLEN];
     union {
 	s32 ID;
@@ -3933,7 +3955,7 @@
 static int
 PCI_signature(char *name, struct bus_type *lp)
 {
-    c_char *de4x5_signatures[] = DE4X5_SIGNATURE;
+    static c_char *de4x5_signatures[] = DE4X5_SIGNATURE;
     int i, status = 0, siglen = sizeof(de4x5_signatures)/sizeof(c_char *);
     
     if (lp->chipset == DC21040) {
@@ -5789,7 +5811,6 @@
 {
     int i, j=0;
     char name[DE4X5_STRLEN];
-    u_char pb, dev_fn;
     u_short vendor;
     u_int class = DE4X5_CLASS_CODE;
     u_int device;
@@ -5804,13 +5825,7 @@
 #endif
     if (!pcibios_present()) return j;
 
-    for (i=0; 
-	 (pcibios_find_class(class, i, &pb, &dev_fn)!= PCIBIOS_DEVICE_NOT_FOUND);
-	 i++) {
-	for (pdev = pci_devices; pdev; pdev = pdev->next) {
-	    if ((pdev->bus->number==pb) && (pdev->devfn==dev_fn)) break;
-	}
-
+    for (i=0; (pdev=de4x5_find_class(class, i))!= NULL; i++) {
 	vendor = pdev->vendor;
 	device = pdev->device << 8;
 	if (is_DC21040 || is_DC21041 || is_DC21140 || is_DC2114x) j++;

-
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.altern.org/andrebalsa/doc/lkml-faq.html


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic