Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid S. Miller <davem@nuts.ninka.net>2003-10-16 12:42:49 -0700
committerStephen Hemminger <shemminger@osdl.org>2003-10-16 12:42:49 -0700
commit21f6cbbba9b518f69b90bfdb4efd3a8c916b83ac (patch)
tree097b1567c29d71ad4ecc6c4443ac57e1d798cc05
parent5fae2ae304eac180137bd6e136e31936068106c3 (diff)
[NET]: Convert sk98lin away from init_etherdev.
-rw-r--r--drivers/net/sk98lin/skge.c67
1 files changed, 30 insertions, 37 deletions
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c
index 60cbb3d85690..5da46110913f 100644
--- a/drivers/net/sk98lin/skge.c
+++ b/drivers/net/sk98lin/skge.c
@@ -653,24 +653,16 @@ static int __init skge_probe (void)
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 "
"structure!\n");
break;
}
- if (dev->priv == NULL) {
- printk(KERN_ERR "Unable to allocate adapter "
- "structure!\n");
- break;
- }
-
pNet = dev->priv;
pNet->pAC = kmalloc(sizeof(SK_AC), GFP_KERNEL);
if (pNet->pAC == NULL){
- dev->get_stats = NULL;
- unregister_netdev(dev);
- kfree(dev->priv);
+ free_netdev(dev);
printk(KERN_ERR "Unable to allocate adapter "
"structure!\n");
break;
@@ -699,9 +691,7 @@ static int __init skge_probe (void)
retval = SkGeInitPCI(pAC);
if (retval) {
printk("SKGE: PCI setup failed: %i\n", retval);
- dev->get_stats = NULL;
- unregister_netdev(dev);
- kfree(dev);
+ free_netdev(dev);
continue;
}
@@ -730,13 +720,20 @@ static int __init skge_probe (void)
pAC->Index = boards_found;
if (SkGeBoardInit(dev, pAC)) {
FreeResources(dev);
- kfree(dev);
+ free_netdev(dev);
continue;
}
memcpy((caddr_t) &dev->dev_addr,
(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 */
#ifdef CONFIG_PROC_FS
if (!DeviceFound) {
@@ -767,21 +764,11 @@ static int __init skge_probe (void)
pNet->PortNr = 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++;
/* More then one port found */
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 "
"structure!\n");
break;
@@ -814,22 +801,28 @@ static int __init skge_probe (void)
#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
- if (pSkRootDir
- && (pProcFile = create_proc_entry(dev->name,
- S_IRUGO,
- pSkRootDir))) {
- pProcFile->proc_fops = &sk_proc_fops;
- pProcFile->data = dev;
- }
+ if (pSkRootDir
+ && (pProcFile = create_proc_entry(dev->name,
+ S_IRUGO,
+ pSkRootDir))) {
+ pProcFile->proc_fops = &sk_proc_fops;
+ pProcFile->data = dev;
+ }
#endif
- memcpy((caddr_t) &dev->dev_addr,
- (caddr_t) &pAC->Addr.Net[1].CurrentMacAddress, 6);
+ memcpy((caddr_t) &dev->dev_addr,
+ (caddr_t) &pAC->Addr.Net[1].CurrentMacAddress, 6);
- printk("%s: %s\n", dev->name, pAC->DeviceStr);
- printk(" PrefPort:B RlmtMode:Dual Check Link State\n");
-
+ printk("%s: %s\n", dev->name, pAC->DeviceStr);
+ printk(" PrefPort:B RlmtMode:Dual Check Link State\n");
+ }
}