netdev
[Top] [All Lists]

[PATCH] Mixed PCI/ISA device name conflicts

To: Jeff Garzik <jgarzik@xxxxxxxxx>
Subject: [PATCH] Mixed PCI/ISA device name conflicts
From: Stephen Hemminger <shemminger@xxxxxxxx>
Date: Fri, 16 Apr 2004 09:46:14 -0700
Cc: netdev@xxxxxxxxxxx
In-reply-to: <407C33A4.3010804@pobox.com>
Organization: Open Source Development Lab
References: <20031222091115.42dd5f1f.shemminger@osdl.org> <405F994B.6080501@pobox.com> <20040329153236.0cf427c9@dell_ss3.pdx.osdl.net> <407C33A4.3010804@pobox.com>
Sender: netdev-bounce@xxxxxxxxxxx
In systems with mixed network cards, and all drivers compiled into
the kernel; the PCI device (eth0) will get probed first, before the ISA.

The problem is that the ISA device can mistakenly try to probe
for eth0.  The problem is that the ISA driver will not detect the failure
until it goes to call register_netdevice, and not all drivers have
perfect error unwind code. 

This patch short circuits the device probe, so it won't bother
looking for devices that already are registered.

diff -Nru a/net/core/dev.c b/net/core/dev.c
--- a/net/core/dev.c    Fri Apr 16 09:37:20 2004
+++ b/net/core/dev.c    Fri Apr 16 09:37:20 2004
@@ -432,6 +432,14 @@
        int i;
 
        sprintf(name, "%s%d", prefix, unit);
+
+       /*
+        * If device already registered then return base of 1
+        * to indicate not to probe for this interface
+        */
+       if (__dev_get_by_name(name))
+               return 1;
+
        for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++)
                if (!strcmp(name, s[i].name))
                        return s[i].map.base_addr;

<Prev in Thread] Current Thread [Next in Thread>