Commit a043bc4c authored by David S. Miller's avatar David S. Miller

[NET]: Move arch/cris drivers away from init_etherdev().

parent 132508c8
...@@ -292,37 +292,19 @@ static void e100_set_network_leds(int active); ...@@ -292,37 +292,19 @@ static void e100_set_network_leds(int active);
*/ */
static int __init static int __init
etrax_ethernet_init(struct net_device *dev) etrax_ethernet_init(void)
{ {
int i; struct net_device *dev;
int i, err;
int anOffset = 0; int anOffset = 0;
printk("ETRAX 100LX 10/100MBit ethernet v2.0 (c) 2000-2001 Axis Communications AB\n"); printk("ETRAX 100LX 10/100MBit ethernet v2.0 (c) 2000-2001 Axis Communications AB\n");
dev->base_addr = (unsigned int)R_NETWORK_SA_0; /* just to have something to show */ dev = alloc_etherdev(sizeof(struct net_local));
printk("%s initialized\n", dev->name);
/* make Linux aware of the new hardware */
if (!dev) {
printk(KERN_WARNING "%s: dev == NULL. Should this happen?\n",
cardname);
dev = init_etherdev(dev, sizeof(struct net_local));
if (!dev) if (!dev)
panic("init_etherdev failed\n");
}
/* setup generic handlers and stuff in the dev struct */
ether_setup(dev);
/* make room for the local structure containing stats etc */
dev->priv = kmalloc(sizeof(struct net_local), GFP_KERNEL);
if (dev->priv == NULL)
return -ENOMEM; return -ENOMEM;
memset(dev->priv, 0, sizeof(struct net_local));
dev->base_addr = (unsigned int)R_NETWORK_SA_0; /* just to have something to show */
/* now setup our etrax specific stuff */ /* now setup our etrax specific stuff */
...@@ -340,10 +322,6 @@ etrax_ethernet_init(struct net_device *dev) ...@@ -340,10 +322,6 @@ etrax_ethernet_init(struct net_device *dev)
dev->do_ioctl = e100_ioctl; dev->do_ioctl = e100_ioctl;
dev->tx_timeout = e100_tx_timeout; dev->tx_timeout = e100_tx_timeout;
/* set the default MAC address */
e100_set_mac_address(dev, &default_mac);
/* Initialise the list of Etrax DMA-descriptors */ /* Initialise the list of Etrax DMA-descriptors */
/* Initialise receive descriptors */ /* Initialise receive descriptors */
...@@ -371,6 +349,16 @@ etrax_ethernet_init(struct net_device *dev) ...@@ -371,6 +349,16 @@ etrax_ethernet_init(struct net_device *dev)
myLastRxDesc = &RxDescList[NBR_OF_RX_DESC - 1]; myLastRxDesc = &RxDescList[NBR_OF_RX_DESC - 1];
myPrevRxDesc = &RxDescList[NBR_OF_RX_DESC - 1]; myPrevRxDesc = &RxDescList[NBR_OF_RX_DESC - 1];
err = register_netdev(dev);
if (err) {
kfree(dev);
return err;
}
/* set the default MAC address */
e100_set_mac_address(dev, &default_mac);
/* Initialize speed indicator stuff. */ /* Initialize speed indicator stuff. */
current_speed = 10; current_speed = 10;
...@@ -1349,19 +1337,10 @@ e100_set_network_leds(int active) ...@@ -1349,19 +1337,10 @@ e100_set_network_leds(int active)
} }
} }
static struct net_device dev_etrax_ethernet; /* only got one */
static int static int
etrax_init_module(void) etrax_init_module(void)
{ {
struct net_device *d = &dev_etrax_ethernet; return etrax_ethernet_init();
d->init = etrax_ethernet_init;
if (register_netdev(d) == 0)
return 0;
else
return -ENODEV;
} }
module_init(etrax_init_module); module_init(etrax_init_module);
...@@ -162,37 +162,19 @@ extern unsigned char e100lpslaveprog; ...@@ -162,37 +162,19 @@ extern unsigned char e100lpslaveprog;
* (detachable devices only). * (detachable devices only).
*/ */
static int __init static int __init
etrax_ethernet_lpslave_init(struct net_device *dev) etrax_ethernet_lpslave_init(void)
{ {
int i; struct net_device *dev;
int i, err;
int anOffset = 0; int anOffset = 0;
printk("Etrax/100 lpslave ethernet driver v0.3, (c) 1999 Axis Communications AB\n"); printk("Etrax/100 lpslave ethernet driver v0.3, (c) 1999 Axis Communications AB\n");
dev->base_addr = 2; dev = alloc_etherdev(sizeof(struct net_lock));
printk("%s initialized\n", dev->name);
/* make Linux aware of the new hardware */
if (!dev) {
printk(KERN_WARNING "%s: dev == NULL. Should this happen?\n",
cardname);
dev = init_etherdev(dev, sizeof(struct net_local));
if (!dev) if (!dev)
panic("init_etherdev failed\n");
}
/* setup generic handlers and stuff in the dev struct */
ether_setup(dev);
/* make room for the local structure containing stats etc */
dev->priv = kmalloc(sizeof(struct net_local), GFP_KERNEL);
if (dev->priv == NULL)
return -ENOMEM; return -ENOMEM;
memset(dev->priv, 0, sizeof(struct net_local));
dev->base_addr = 2;
/* now setup our etrax specific stuff */ /* now setup our etrax specific stuff */
...@@ -242,7 +224,11 @@ etrax_ethernet_lpslave_init(struct net_device *dev) ...@@ -242,7 +224,11 @@ etrax_ethernet_lpslave_init(struct net_device *dev)
TxDescList[0].buf = virt_to_phys(&host_command); TxDescList[0].buf = virt_to_phys(&host_command);
TxDescList[0].next = virt_to_phys(&TxDescList[1]); TxDescList[0].next = virt_to_phys(&TxDescList[1]);
return 0; err = register_netdev(dev);
if (err)
kfree(dev);
return err;
} }
/* set MAC address of the interface. called from the core after a /* set MAC address of the interface. called from the core after a
...@@ -1017,19 +1003,10 @@ dump_parport_status(void) ...@@ -1017,19 +1003,10 @@ dump_parport_status(void)
} }
#endif /* ETHDEBUG */ #endif /* ETHDEBUG */
static struct net_device dev_etrax_slave_ethernet;
static int static int
etrax_init_module(void) etrax_init_module(void)
{ {
struct net_device *d = &dev_etrax_slave_ethernet; return etrax_ethernet_lpslave_init();
d->init = etrax_ethernet_lpslave_init;
if(register_netdev(d) == 0)
return 0;
else
return -ENODEV;
} }
module_init(etrax_init_module); module_init(etrax_init_module);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment