"loading device 'ethN+1'" bugfix.

Tigran Aivazian (tigran@aivazian.demon.co.uk)
Mon, 25 May 1998 18:32:58 +0100 (BST)


Dear Linux-Net,

I suggest that we remove the statement:

printk("loading device '%s'...\n", dev->name);

from the function etherdev_get_index() in drivers/net/net_init.c.

Here is the justification. If you look at init_module() of, say, ne.c you will
find that it calls register_netdev() in a loop, prepared for (possibly) multiple
ne2k cards. Thus, it is prepared for register_netdev() to fail and initializes
it's own structures accordingly. However, register_netdev() calls
etherdev_get_index() which displays the "loading device 'ethX'..." message,
even though, later on, when the "real" register_netdevice() is called (that
actually invokes dev->init routine) the physical device may not be there and
all we shall get is a strange "loading device ethX+1..." message on the next
loop, like this:

loading device 'eth0'...
ne.c:v1.10 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)
NE*000 ethercard probe at 0x300: 00 48 45 80 6d 3a
eth0: NE2000 found at 0x300, using IRQ 5.
loading device 'eth1'...

If you look at the init_module() function that I extracted from ne.c source
below you will see what I mean...

/* extracted from drivers/net/ne.c */
int
init_module(void)
{
int this_dev, found = 0;

for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) {
struct device *dev = &dev_ne[this_dev];
dev->name = namelist+(NAMELEN*this_dev);
dev->irq = irq[this_dev];
dev->mem_end = bad[this_dev];
dev->base_addr = io[this_dev];
dev->init = ne_probe;
if (register_netdev(dev) == 0) {
found++;
continue;
}
if (found != 0) /* Got at least one. */
return 0;
if (io[this_dev] != 0)
printk(KERN_WARNING "ne.c: No NE*000 card found at i/o = %#x\n", io[this_dev]);
else
printk(KERN_NOTICE "ne.c: No PCI cards found. Use \"io=0xNNN\" value(s) for ISA cards.\n");
return -ENXIO;
}

return 0;
}

Regards,
Tigran.

-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.rutgers.edu