From 5691ce005540b0b2f847d2db3eaa53445af6c5be Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 3 Sep 2003 10:39:24 -0700 Subject: [PATCH] [NET]: Convert ether probes to probe_old_netdevs(). Convert old ethernet device probing from dev_base linked list to the probe_old_netdevs. Blame me for this one ;-) Builds and runs, but don't have old ISA hardware to really test it. So please find some or review it carefully. --- drivers/net/Space.c | 96 +++++++++++++++------------------------------ 1 file changed, 32 insertions(+), 64 deletions(-) diff --git a/drivers/net/Space.c b/drivers/net/Space.c index c13607036260f..2fb13e14b4773 100644 --- a/drivers/net/Space.c +++ b/drivers/net/Space.c @@ -32,6 +32,7 @@ */ #include #include +#include #include #include #include @@ -358,39 +359,52 @@ static struct devprobe mips_probes[] __initdata = { * per bus interface. This drives the legacy devices only for now. */ -static int __init ethif_probe(struct net_device *dev) +static int __init ethif_probe(void) { - unsigned long base_addr = dev->base_addr; + struct net_device *dev; + int err = -ENODEV; + + dev = alloc_etherdev(0); + if (!dev) + return -ENOMEM; + + netdev_boot_setup_check(dev); /* * Backwards compatibility - historically an I/O base of 1 was * used to indicate not to probe for this ethN interface */ - if (base_addr == 1) - return 1; /* ENXIO */ + if (dev->base_addr == 1) { + free_netdev(dev); + return -ENXIO; + } /* * The arch specific probes are 1st so that any on-board ethernet * will be probed before other ISA/EISA/MCA/PCI bus cards. */ - if (probe_list(dev, m68k_probes) == 0) - return 0; - if (probe_list(dev, mips_probes) == 0) - return 0; - if (probe_list(dev, eisa_probes) == 0) - return 0; - if (probe_list(dev, mca_probes) == 0) - return 0; - if (probe_list(dev, isa_probes) == 0) - return 0; - if (probe_list(dev, parport_probes) == 0) - return 0; - return -ENODEV; + if (probe_list(dev, m68k_probes) == 0 || + probe_list(dev, mips_probes) == 0 || + probe_list(dev, eisa_probes) == 0 || + probe_list(dev, mca_probes) == 0 || + probe_list(dev, isa_probes) == 0 || + probe_list(dev, parport_probes) == 0) + err = register_netdev(dev); + + if (err) + free_netdev(dev); + return err; + } /* Statically configured drivers -- order matters here. */ -void probe_old_netdevs(void) +void __init probe_old_netdevs(void) { + int num; + + for (num = 0; num < 8; ++num) + if (ethif_probe()) + break; #ifdef CONFIG_COPS cops_probe(0); cops_probe(1); @@ -413,52 +427,6 @@ static struct net_device dev_ltpc = { #define NEXT_DEV (&dev_ltpc) #endif /* LTPC */ -static struct net_device eth7_dev = { - .name = "eth%d", - .next = NEXT_DEV, - .init = ethif_probe, -}; -static struct net_device eth6_dev = { - .name = "eth%d", - .next = ð7_dev, - .init = ethif_probe, -}; -static struct net_device eth5_dev = { - .name = "eth%d", - .next = ð6_dev, - .init = ethif_probe, -}; -static struct net_device eth4_dev = { - .name = "eth%d", - .next = ð5_dev, - .init = ethif_probe, -}; -static struct net_device eth3_dev = { - .name = "eth%d", - .next = ð4_dev, - .init = ethif_probe, -}; -static struct net_device eth2_dev = { - .name = "eth%d", - .next = ð3_dev, - .init = ethif_probe, -}; -static struct net_device eth1_dev = { - .name = "eth%d", - .next = ð2_dev, - .init = ethif_probe, -}; -static struct net_device eth0_dev = { - .name = "eth%d", - .next = ð1_dev, - .init = ethif_probe, -}; - -#undef NEXT_DEV -#define NEXT_DEV (ð0_dev) - - - #ifdef CONFIG_TR /* Token-ring device probe */ extern int ibmtr_probe(struct net_device *); -- 2.53.0