[PATCH] 2.5.24 - drivers/net/tlan.c dma mapping 1/10

From: Francois Romieu (romieu@cogenit.fr)
Date: Sun Jun 30 2002 - 10:18:52 EST


- removal of code duplication.

--- linux-2.5.24/drivers/net/tlan.c Sat Jun 29 21:59:16 2002
+++ linux-2.5.24/drivers/net/tlan.c Sat Jun 29 22:01:37 2002
@@ -295,6 +295,7 @@ static int TLan_ioctl( struct net_device
 static int TLan_probe1( struct pci_dev *pdev, long ioaddr, int irq, int rev, const struct pci_device_id *ent);
 static void TLan_tx_timeout( struct net_device *dev);
 static int tlan_init_one( struct pci_dev *pdev, const struct pci_device_id *ent);
+static void TLan_Release_Dev(struct net_device *);
 
 static u32 TLan_HandleInvalid( struct net_device *, u16 );
 static u32 TLan_HandleTxEOF( struct net_device *, u16 );
@@ -415,18 +416,8 @@ TLan_SetTimer( struct net_device *dev, u
 static void __devexit tlan_remove_one( struct pci_dev *pdev)
 {
         struct net_device *dev = pci_get_drvdata( pdev );
- TLanPrivateInfo *priv = dev->priv;
-
- unregister_netdev( dev );
-
- if ( priv->dmaStorage ) {
- kfree( priv->dmaStorage );
- }
-
- release_region( dev->base_addr, 0x10 );
-
- kfree( dev );
                 
+ TLan_Release_Dev(dev);
         pci_set_drvdata( pdev, NULL );
 }
 
@@ -627,23 +618,25 @@ static int __devinit TLan_probe1(struct
 
 }
 
+static void TLan_Release_Dev(struct net_device *dev)
+{
+ TLanPrivateInfo *priv = dev->priv;
+
+ if (priv->dmaStorage)
+ kfree(priv->dmaStorage);
+ release_region(dev->base_addr, 0x10);
+ unregister_netdev(dev);
+}
 
 static void TLan_Eisa_Cleanup(void)
 {
- struct net_device *dev;
- TLanPrivateInfo *priv;
+ for (; tlan_have_eisa; tlan_have_eisa--) {
+ struct net_device *dev = TLan_Eisa_Devices;
+ TLanPrivateInfo *priv = dev->priv;
         
- while( tlan_have_eisa ) {
- dev = TLan_Eisa_Devices;
- priv = dev->priv;
- if (priv->dmaStorage) {
- kfree(priv->dmaStorage);
- }
- release_region( dev->base_addr, 0x10);
- unregister_netdev( dev );
+ TLan_Release_Dev(dev);
                 TLan_Eisa_Devices = priv->nextDevice;
                 kfree( dev );
- tlan_have_eisa--;
         }
 }
         
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jun 30 2002 - 22:00:14 EST