Commit 21f6cbbb authored by David S. Miller's avatar David S. Miller Committed by Stephen Hemminger

[NET]: Convert sk98lin away from init_etherdev.

parent 5fae2ae3
...@@ -653,24 +653,16 @@ static int __init skge_probe (void) ...@@ -653,24 +653,16 @@ static int __init skge_probe (void)
continue; continue;
if ((dev = init_etherdev(dev, sizeof(DEV_NET))) == NULL) { if ((dev = alloc_etherdev(sizeof(DEV_NET))) == NULL) {
printk(KERN_ERR "Unable to allocate etherdev " printk(KERN_ERR "Unable to allocate etherdev "
"structure!\n"); "structure!\n");
break; break;
} }
if (dev->priv == NULL) {
printk(KERN_ERR "Unable to allocate adapter "
"structure!\n");
break;
}
pNet = dev->priv; pNet = dev->priv;
pNet->pAC = kmalloc(sizeof(SK_AC), GFP_KERNEL); pNet->pAC = kmalloc(sizeof(SK_AC), GFP_KERNEL);
if (pNet->pAC == NULL){ if (pNet->pAC == NULL){
dev->get_stats = NULL; free_netdev(dev);
unregister_netdev(dev);
kfree(dev->priv);
printk(KERN_ERR "Unable to allocate adapter " printk(KERN_ERR "Unable to allocate adapter "
"structure!\n"); "structure!\n");
break; break;
...@@ -699,9 +691,7 @@ static int __init skge_probe (void) ...@@ -699,9 +691,7 @@ static int __init skge_probe (void)
retval = SkGeInitPCI(pAC); retval = SkGeInitPCI(pAC);
if (retval) { if (retval) {
printk("SKGE: PCI setup failed: %i\n", retval); printk("SKGE: PCI setup failed: %i\n", retval);
dev->get_stats = NULL; free_netdev(dev);
unregister_netdev(dev);
kfree(dev);
continue; continue;
} }
...@@ -730,13 +720,20 @@ static int __init skge_probe (void) ...@@ -730,13 +720,20 @@ static int __init skge_probe (void)
pAC->Index = boards_found; pAC->Index = boards_found;
if (SkGeBoardInit(dev, pAC)) { if (SkGeBoardInit(dev, pAC)) {
FreeResources(dev); FreeResources(dev);
kfree(dev); free_netdev(dev);
continue; continue;
} }
memcpy((caddr_t) &dev->dev_addr, memcpy((caddr_t) &dev->dev_addr,
(caddr_t) &pAC->Addr.Net[0].CurrentMacAddress, 6); (caddr_t) &pAC->Addr.Net[0].CurrentMacAddress, 6);
if (register_netdev(dev)) {
printk(KERN_ERR "SKGE: Could not register device.\n");
FreeResources(dev);
free_netdev(dev);
continue;
}
/* First adapter... Create proc and print message */ /* First adapter... Create proc and print message */
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
if (!DeviceFound) { if (!DeviceFound) {
...@@ -767,21 +764,11 @@ static int __init skge_probe (void) ...@@ -767,21 +764,11 @@ static int __init skge_probe (void)
pNet->PortNr = 0; pNet->PortNr = 0;
pNet->NetNr = 0; pNet->NetNr = 0;
#ifdef SK_ZEROCOPY
#ifdef USE_SK_TX_CHECKSUM
if (pAC->ChipsetType) {
/* SG and ZEROCOPY - fly baby... */
dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
}
#endif
#endif
boards_found++; boards_found++;
/* More then one port found */ /* More then one port found */
if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 2)) { if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 2)) {
if ((dev = init_etherdev(NULL, sizeof(DEV_NET))) == 0) { if ((dev = alloc_etherdev(sizeof(DEV_NET))) == 0) {
printk(KERN_ERR "Unable to allocate etherdev " printk(KERN_ERR "Unable to allocate etherdev "
"structure!\n"); "structure!\n");
break; break;
...@@ -814,6 +801,12 @@ static int __init skge_probe (void) ...@@ -814,6 +801,12 @@ static int __init skge_probe (void)
#endif #endif
#endif #endif
if (register_netdev(dev)) {
printk(KERN_ERR "SKGE: Could not register "
"second port.\n");
free_netdev(dev);
pAC->dev[1] = pAC->dev[0];
} else {
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
if (pSkRootDir if (pSkRootDir
&& (pProcFile = create_proc_entry(dev->name, && (pProcFile = create_proc_entry(dev->name,
...@@ -829,7 +822,7 @@ static int __init skge_probe (void) ...@@ -829,7 +822,7 @@ static int __init skge_probe (void)
printk("%s: %s\n", dev->name, pAC->DeviceStr); printk("%s: %s\n", dev->name, pAC->DeviceStr);
printk(" PrefPort:B RlmtMode:Dual Check Link State\n"); printk(" PrefPort:B RlmtMode:Dual Check Link State\n");
}
} }
......
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