Commit 9ba3c9af authored by David S. Miller's avatar David S. Miller Committed by Stephen Hemminger

[NET]: Convert myri_sbus away from init_etherdev.

parent bc20be4b
...@@ -888,15 +888,16 @@ static void dump_eeprom(struct myri_eth *mp) ...@@ -888,15 +888,16 @@ static void dump_eeprom(struct myri_eth *mp)
} }
#endif #endif
static int __init myri_ether_init(struct net_device *dev, struct sbus_dev *sdev, int num) static int __init myri_ether_init(struct sbus_dev *sdev, int num)
{ {
static unsigned version_printed; static unsigned version_printed;
struct net_device *dev;
struct myri_eth *mp; struct myri_eth *mp;
unsigned char prop_buf[32]; unsigned char prop_buf[32];
int i; int i;
DET(("myri_ether_init(%p,%p,%d):\n", dev, sdev, num)); DET(("myri_ether_init(%p,%d):\n", sdev, num));
dev = init_etherdev(0, sizeof(struct myri_eth)); dev = alloc_etherdev(sizeof(struct myri_eth));
if (!dev) if (!dev)
return -ENOMEM; return -ENOMEM;
...@@ -904,8 +905,6 @@ static int __init myri_ether_init(struct net_device *dev, struct sbus_dev *sdev, ...@@ -904,8 +905,6 @@ static int __init myri_ether_init(struct net_device *dev, struct sbus_dev *sdev,
if (version_printed++ == 0) if (version_printed++ == 0)
printk(version); printk(version);
printk("%s: MyriCOM MyriNET Ethernet ", dev->name);
mp = (struct myri_eth *) dev->priv; mp = (struct myri_eth *) dev->priv;
spin_lock_init(&mp->irq_lock); spin_lock_init(&mp->irq_lock);
mp->myri_sdev = sdev; mp->myri_sdev = sdev;
...@@ -974,10 +973,7 @@ static int __init myri_ether_init(struct net_device *dev, struct sbus_dev *sdev, ...@@ -974,10 +973,7 @@ static int __init myri_ether_init(struct net_device *dev, struct sbus_dev *sdev,
#endif #endif
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
printk("%2.2x%c", dev->dev_addr[i] = mp->eeprom.id[i];
dev->dev_addr[i] = mp->eeprom.id[i],
i == 5 ? ' ' : ':');
printk("\n");
determine_reg_space_size(mp); determine_reg_space_size(mp);
...@@ -1072,9 +1068,6 @@ static int __init myri_ether_init(struct net_device *dev, struct sbus_dev *sdev, ...@@ -1072,9 +1068,6 @@ static int __init myri_ether_init(struct net_device *dev, struct sbus_dev *sdev,
goto err; goto err;
} }
DET(("ether_setup()\n"));
ether_setup(dev);
dev->mtu = MYRINET_MTU; dev->mtu = MYRINET_MTU;
dev->change_mtu = myri_change_mtu; dev->change_mtu = myri_change_mtu;
dev->hard_header = myri_header; dev->hard_header = myri_header;
...@@ -1087,15 +1080,30 @@ static int __init myri_ether_init(struct net_device *dev, struct sbus_dev *sdev, ...@@ -1087,15 +1080,30 @@ static int __init myri_ether_init(struct net_device *dev, struct sbus_dev *sdev,
DET(("Loading LANAI firmware\n")); DET(("Loading LANAI firmware\n"));
myri_load_lanai(mp); myri_load_lanai(mp);
if (register_netdev(dev)) {
printk("MyriCOM: Cannot register device.\n");
goto err_free_irq;
}
#ifdef MODULE #ifdef MODULE
dev->ifindex = dev_new_index();
mp->next_module = root_myri_dev; mp->next_module = root_myri_dev;
root_myri_dev = mp; root_myri_dev = mp;
#endif #endif
printk("%s: MyriCOM MyriNET Ethernet ", dev->name);
for (i = 0; i < 6; i++)
printk("%2.2x%c", dev->dev_addr[i],
i == 5 ? ' ' : ':');
printk("\n");
return 0; return 0;
err: unregister_netdev(dev);
err_free_irq:
free_irq(dev->irq, dev);
err:
/* This will also free the co-allocated 'dev->priv' */ /* This will also free the co-allocated 'dev->priv' */
kfree(dev); free_netdev(dev);
return -ENODEV; return -ENODEV;
} }
...@@ -1112,7 +1120,6 @@ static int __init myri_sbus_match(struct sbus_dev *sdev) ...@@ -1112,7 +1120,6 @@ static int __init myri_sbus_match(struct sbus_dev *sdev)
static int __init myri_sbus_probe(void) static int __init myri_sbus_probe(void)
{ {
struct net_device *dev = NULL;
struct sbus_bus *bus; struct sbus_bus *bus;
struct sbus_dev *sdev = 0; struct sbus_dev *sdev = 0;
static int called; static int called;
...@@ -1128,12 +1135,10 @@ static int __init myri_sbus_probe(void) ...@@ -1128,12 +1135,10 @@ static int __init myri_sbus_probe(void)
for_each_sbus(bus) { for_each_sbus(bus) {
for_each_sbusdev(sdev, bus) { for_each_sbusdev(sdev, bus) {
if (cards)
dev = NULL;
if (myri_sbus_match(sdev)) { if (myri_sbus_match(sdev)) {
cards++; cards++;
DET(("Found myricom myrinet as %s\n", sdev->prom_name)); DET(("Found myricom myrinet as %s\n", sdev->prom_name));
if ((v = myri_ether_init(dev, sdev, (cards - 1)))) if ((v = myri_ether_init(sdev, (cards - 1))))
return v; return v;
} }
} }
......
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