2.5.24 : drivers/net/tlan.c
Subsystems (2)
PATCH 1/1 2.5.24 : drivers/net/tlan.c
Hello all,
This patch adds the check for 32-bit DMA capability for the tlan driver.
This is the first step for Documentation/DMA-mapping.txt compliance. As for the preferred action if the driver fails on pci_set_dma_mask(), I plan to add that in a future patch. Please review.
Regards,
Frank
net/tlan.c renamed from net/tlan.c.old +4 -0
@@ -516,6 +516,10 @@if (pdev &&pci_enable_device (pdev))return -EIO ; +if (pci_set_dma_mask (pdev,0xffffffff )) + { +printk (KERN_WARNING "tlan : No suitable DMA available.\n" ); + } dev =init_etherdev (NULL ,sizeof (TLanPrivateInfo));if (dev ==NULL ) {
Re,
Frank Davis <[email protected]> :
Quoted 5 lines
Hello all,
This patch adds the check for 32-bit DMA capability for the tlan driver.
This is the first step forDocumentation/DMA-mapping.txtcompliance. As for the preferred action if the driver fails onpci_set_dma_mask(), I plan to add that in a future patch. Please review.
See comment regarding scsi drivers.
I've done some work for this one and rrunner around 2.4.7. Give me 24h to dig the mail archive and see what the missing parts/problems were, ok ?
Btw, you may Cc:[email protected] as well as the adequate maintainer if there's one.
Signature · 1 line
Ueimor
Re: [PATCH] 2.5.24 : drivers/net/tlan.c; drivers/net/rrunner.c
Greetings,
[remaining DMA-mapping conversion in drivers/net]
- tlan plays isa/pci and does as well some interesting things with copy buffers. The patch is attached but I'll feel safer if somebody with the adequate hardware at hand appears.
- Imho rrunner wouldn't suffer from compat code removal + pci driver init style + DMA mapping conversion. I'd like to know what the maintainer thinks before resurrecting the patch. Jes ?
Signature · 1 line
Ueimor
Re: [PATCH] 2.5.24 : drivers/net/tlan.c; drivers/net/rrunner.c
Quoted 7 lines · Francois Romieu
Greetings,
[remaining DMA-mapping conversion in
drivers/net]- tlan plays isa/pci and does as well some interesting things with copy buffers. The patch is attached but I'll feel safer if somebody with the adequate hardware at hand appears.
I've got some tlan cards
Quoted 3 lines
- Imho rrunner wouldn't suffer from compat code removal + pci driver init style + DMA mapping conversion. I'd like to know what the maintainer thinks before resurrecting the patch. Jes ?
Just make sure you split it up... one of the reasons why I have stalled applying davej's 2.4.x->2.5.x rrunner patch is that it's pretty darn huge, even though the changes are fairly minor. (nothing against davej, of course)
Jeff
Re: [PATCH] 2.5.24 : drivers/net/tlan.c; drivers/net/rrunner.c
Quoted 4 lines · Jeff Garzik
Just make sure you split it up... one of the reasons why I have stalled applying davej's 2.4.x->2.5.x rrunner patch is that it's pretty darn huge, even though the changes are fairly minor. (nothing against davej, of course)
There are a few net drivers just like that, which have seen quite a bit of development in 2.4. Over time, it's possible the authors of the drivers will submit stuff through you (or to Linus) bit by bit. At which point, what's in my tree only serves as a "oh, you missed this bit" service.
Dave
Signature · 2 lines
| Dave Jones. http://www.codemonkey.org.uk | SuSE Labs
PATCH 1/1 2.5.24 - drivers/net/tlan.c dma mapping 0/10
In reply to Jeff Garzik- missing include and #error removal in order to compile.
drivers/net/tlan.h +1 -1
@@ -25,7 +25,7 @@#include <asm/io.h> #include <asm/types.h> #include <linux/netdevice.h> - +#include <linux/tqueue.h> /*****************************************************************
drivers/net/tlan.c +0 -2
@@ -166,8 +166,6 @@* Thanks to Gunnar Eikman *******************************************************************************/ -#error Please convert me to Documentation/DMA-mapping.txt -#include <linux/module.h> #include "tlan.h"
PATCH 1/1 2.5.24 - drivers/net/tlan.c dma mapping 1/10
In reply to Jeff Garzik- removal of code duplication.
drivers/net/tlan.c +15 -22
@@ -295,6 +295,7 @@ static int TLan_ioctl( struct net_devicestatic 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--; } }
PATCH 1/1 2.5.24 - drivers/net/tlan.c dma mapping 8/10
In reply to Jeff Garzik- descriptors converted to synchronous DMA mapping.
drivers/net/tlan.h +1 -1
@@ -173,8 +173,8 @@ typedef struct tlan_private_tag {struct pci_dev *pci_dev;dma_addr_t rxBuffer_dma;dma_addr_t txBuffer_dma; +dma_addr_t lists_dma;struct net_device *nextDevice; -void *dmaStorage;u8 *padBuffer;TLanList *rxList;u8 *rxBuffer;
drivers/net/tlan.c +32 -24
131 lines not on this page · raw message
PATCH 1/1 2.5.24 - drivers/net/tlan.c dma mapping 6/10
In reply to Jeff Garzik- TLAN Rx/Tx buffers virt_to_bus -> pci_map_single conversion.
drivers/net/tlan.h +3 -0
@@ -41,6 +41,7 @@#define TLAN_NUM_RX_LISTS 32#define TLAN_NUM_TX_LISTS 64 +#define TLAN_NUM_ALL_LISTS (TLAN_NUM_RX_LISTS+TLAN_NUM_TX_LISTS)#define TLAN_IGNORE 0#define TLAN_RECORD 1
@@ -169,6 +170,8 @@ typedef u8 TLanBuffer[TLAN_MAX_FRAME_SIZ typedef struct tlan_private_tag { struct pci_dev *pci_dev; + dma_addr_t rxBuffer_dma; + dma_addr_t txBuffer_dma; struct net_device *nextDevice; void *dmaStorage; u8 *padBuffer;
drivers/net/tlan.c +42 -8
107 lines not on this page · raw message
PATCH 1/1 2.5.24 - drivers/net/tlan.c dma mapping 4/10
In reply to Jeff Garzik- skbuff virt_to_bus -> pci_map_single conversion in Rx/Tx paths.
drivers/net/tlan.h +1 -0
@@ -168,6 +168,7 @@ typedef u8 TLanBuffer[TLAN_MAX_FRAME_SIZ****************************************************************/ typedef struct tlan_private_tag { + struct pci_dev *pci_dev; struct net_device *nextDevice; void *dmaStorage; u8 *padBuffer;
drivers/net/tlan.c +28 -7
@@ -515,6 +515,7 @@ static int __devinit TLan_probe1(structSET_MODULE_OWNER (dev); priv = dev->priv; + priv->pci_dev = pdev;/* Is this a PCI device? */ if (pdev) {
@@ -995,6 +996,7 @@ static void TLan_tx_timeout(struct net_dstatic int TLan_StartTx (struct sk_buff *skb,struct net_device *dev ) {TLanPrivateInfo *priv = dev->priv; +struct pci_dev *pdev = priv->pci_dev;TLanList *tail_list;u8 *tail_buffer;int pad;
@@ -1021,7 +1023,8 @@ static int TLan_StartTx( struct sk_buff tail_buffer = priv->txBuffer + ( priv->txTail *TLAN_MAX_FRAME_SIZE );memcpy ( tail_buffer, skb->data, skb->len ); }else { - tail_list->buffer[0 ].address =virt_to_bus ( skb->data ); + tail_list->buffer[0 ].address =pci_map_single (pdev, skb->data, + skb->len,PCI_DMA_TODEVICE ); tail_list->buffer[9 ].address = (u32 ) skb; }
@@ -1335,6 +1338,7 @@ u32 TLan_HandleInvalid( struct net_devicu32 TLan_HandleTxEOF (struct net_device *dev,u16 host_int ) {TLanPrivateInfo *priv = dev->priv; +struct pci_dev *pdev = priv->pci_dev;int eoc =0 ;TLanList *head_list;u32 ack =0 ;
@@ -1346,7 +1350,11 @@ u32 TLan_HandleTxEOF( struct net_devicewhile (((tmpCStat = head_list->cStat ) &TLAN_CSTAT_FRM_CMP ) && (ack <255 )) { ack++;if ( ! bbuf ) { -dev_kfree_skb_any ( (struct sk_buff *) head_list->buffer[9 ].address ); +struct sk_buff *skb = (struct sk_buff *)head_list->buffer[9 ].address; + +pci_unmap_single (pdev, head_list->buffer[0 ].address, + skb->len,PCI_DMA_TODEVICE ); +dev_kfree_skb_any (skb); head_list->buffer[9 ].address =0 ; }
@@ -1452,6 +1460,7 @@ u32 TLan_HandleStatOverflow( struct net_u32 TLan_HandleRxEOF (struct net_device *dev,u16 host_int ) {TLanPrivateInfo *priv = dev->priv; +struct pci_dev *pdev = priv->pci_dev;u32 ack =0 ;int eoc =0 ;u8 *head_buffer;
@@ -1499,9 +1508,13 @@ u32 TLan_HandleRxEOF( struct net_device new_skb =dev_alloc_skb (TLAN_MAX_FRAME_SIZE +7 );if ( new_skb !=NULL ) { +TLanBufferRef *head_buf = head_list->buffer; +/* If this ever happened it would be a problem */ /* not any more - ac */ - skb = (struct sk_buff *) head_list->buffer[9 ].address; +pci_unmap_single (pdev, head_list->buffer[0 ].address, +TLAN_MAX_FRAME_SIZE ,PCI_DMA_FROMDEVICE ); + skb = (struct sk_buff *) head_buf[9 ].address;skb_trim ( skb, frameSize ); priv->stats.rx_bytes += frameSize;
@@ -1512,9 +1525,10 @@ u32 TLan_HandleRxEOF( struct net_device new_skb->dev = dev;skb_reserve ( new_skb,2 ); t = (void *)skb_put ( new_skb,TLAN_MAX_FRAME_SIZE ); - head_list->buffer[0 ].address =virt_to_bus ( t ); - head_list->buffer[8 ].address = (u32 ) t; - head_list->buffer[9 ].address = (u32 ) new_skb; + head_buf[0 ].address =pci_map_single (pdev, t, +TLAN_MAX_FRAME_SIZE ,PCI_DMA_FROMDEVICE ); + head_buf[8 ].address = (u32 ) t; + head_buf[9 ].address = (u32 ) new_skb; }else printk (KERN_WARNING "TLAN: Couldn't allocate memory for received data.\n" ); }
@@ -1879,6 +1893,7 @@ void TLan_Timer( unsigned long data )void TLan_ResetLists (struct net_device *dev ) {TLanPrivateInfo *priv = dev->priv; +struct pci_dev *pdev = priv->pci_dev;int i;TLanList *list;struct sk_buff *skb;
@@ -1918,7 +1933,8 @@ void TLan_ResetLists( struct net_deviceskb_reserve ( skb,2 ); t = (void *)skb_put ( skb,TLAN_MAX_FRAME_SIZE ); } - list->buffer[0 ].address =virt_to_bus ( t ); + list->buffer[0 ].address =pci_map_single (pdev, t, +TLAN_MAX_FRAME_SIZE ,PCI_DMA_FROMDEVICE ); list->buffer[8 ].address = (u32 ) t; list->buffer[9 ].address = (u32 ) skb; }
@@ -1936,6 +1952,7 @@ void TLan_ResetLists( struct net_devicevoid TLan_FreeLists (struct net_device *dev ) {TLanPrivateInfo *priv = dev->priv; +struct pci_dev *pdev = priv->pci_dev;int i;TLanList *list;struct sk_buff *skb;
@@ -1945,6 +1962,8 @@ void TLan_FreeLists( struct net_device * list = priv->txList + i; skb = (struct sk_buff *) list->buffer[9 ].address;if ( skb ) { +pci_unmap_single (pdev, list->buffer[0 ].address, + skb->len,PCI_DMA_TODEVICE );dev_kfree_skb_any ( skb ); list->buffer[9 ].address =0 ; }
@@ -1954,6 +1973,8 @@ void TLan_FreeLists( struct net_device * list = priv->rxList + i; skb = (struct sk_buff *) list->buffer[9 ].address;if ( skb ) { +pci_unmap_single (pdev, list->buffer[0 ].address, +TLAN_MAX_FRAME_SIZE ,PCI_DMA_FROMDEVICE );dev_kfree_skb_any ( skb ); list->buffer[9 ].address =0 ; }
PATCH 1/1 2.5.24 - drivers/net/tlan.c dma mapping 5/10
In reply to Jeff Garzik- more code duplication removal.
drivers/net/tlan.c +30 -29
@@ -296,6 +296,8 @@ static int TLan_ioctl( struct net_devicestatic 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_ResetTxBuffer (struct pci_dev *,TLanList *); +static void TLan_ResetRxBuffer (struct pci_dev *,TLanList *);static void TLan_Release_Dev (struct net_device *);static u32 TLan_HandleInvalid (struct net_device *,u16 );
@@ -1349,14 +1351,8 @@ u32 TLan_HandleTxEOF( struct net_devicewhile (((tmpCStat = head_list->cStat ) &TLAN_CSTAT_FRM_CMP ) && (ack <255 )) { ack++; -if ( ! bbuf ) { -struct sk_buff *skb = (struct sk_buff *)head_list->buffer[9 ].address; - -pci_unmap_single (pdev, head_list->buffer[0 ].address, - skb->len,PCI_DMA_TODEVICE ); -dev_kfree_skb_any (skb); - head_list->buffer[9 ].address =0 ; - } +if ( ! bbuf ) +TLan_ResetTxBuffer (pdev, head_list);if ( tmpCStat &TLAN_CSTAT_EOC ) eoc =1 ;
@@ -1948,37 +1944,42 @@ void TLan_ResetLists( struct net_device }/* TLan_ResetLists */ - -void TLan_FreeLists (struct net_device *dev ) +static void TLan_ResetTxBuffer (struct pci_dev *pdev,TLanList *list) { -TLanPrivateInfo *priv = dev->priv; -struct pci_dev *pdev = priv->pci_dev; -int i; -TLanList *list; -struct sk_buff *skb; +struct sk_buff *skb = (struct sk_buff *) list->buffer[9 ].address; -if ( ! bbuf ) { -for ( i =0 ; i <TLAN_NUM_TX_LISTS ; i++ ) { - list = priv->txList + i; - skb = (struct sk_buff *) list->buffer[9 ].address; -if ( skb ) { -pci_unmap_single (pdev, list->buffer[0 ].address, - skb->len,PCI_DMA_TODEVICE ); -dev_kfree_skb_any ( skb ); +if (skb) { +pci_unmap_single (pdev, list->buffer[0 ].address, skb->len, +PCI_DMA_TODEVICE ); +dev_kfree_skb_any (skb); list->buffer[9 ].address =0 ; } - } +} + +static void TLan_ResetRxBuffer (struct pci_dev *pdev,TLanList *list) +{ +struct sk_buff *skb = (struct sk_buff *) list->buffer[9 ].address; -for ( i =0 ; i <TLAN_NUM_RX_LISTS ; i++ ) { - list = priv->rxList + i; skb = (struct sk_buff *) list->buffer[9 ].address; -if ( skb ) { +if (skb) {pci_unmap_single (pdev, list->buffer[0 ].address,TLAN_MAX_FRAME_SIZE ,PCI_DMA_FROMDEVICE ); -dev_kfree_skb_any ( skb ); +dev_kfree_skb_any (skb); list->buffer[9 ].address =0 ; } - } +} + +void TLan_FreeLists (struct net_device *dev ) +{ +TLanPrivateInfo *priv = dev->priv; +struct pci_dev *pdev = priv->pci_dev; +int i; + +if ( ! bbuf ) { +for (i =0 ; i <TLAN_NUM_TX_LISTS ; i++) +TLan_ResetTxBuffer (pdev, priv->txList + i); +for (i =0 ; i <TLAN_NUM_RX_LISTS ; i++) +TLan_ResetRxBuffer (pdev, priv->rxList + i); } }/* TLan_FreeLists */
PATCH 1/1 2.5.24 - drivers/net/tlan.c dma mapping 3/10
In reply to Jeff Garzik- (cosmetic) removal of unused variable (pad_allocated);
- (cosmetic) gotoize error paths in TLan_probe1. Extra benefit: code gets correctly indented again.
drivers/net/tlan.c +14 -15
@@ -431,12 +431,9 @@ static struct pci_driver tlan_driver = {static int __init tlan_probe (void ) { -static int pad_allocated; -printk (KERN_INFO "%s" , tlan_banner); - TLanPadBuffer = (u8 *)kmalloc (TLAN_MIN_FRAME_SIZE , -GFP_KERNEL ); + TLanPadBuffer = (u8 *)kmalloc (TLAN_MIN_FRAME_SIZE ,GFP_KERNEL );if (TLanPadBuffer ==NULL ) {printk (KERN_ERR "TLAN: Could not allocate memory for pad buffer.\n" );
@@ -447,7 +444,6 @@ static int __init tlan_probe(void)memset (TLanPadBuffer,0 ,TLAN_MIN_FRAME_SIZE ); - pad_allocated =1 ;TLAN_DBG (TLAN_DEBUG_PROBE ,"Starting PCI Probe....\n" );
@@ -505,7 +501,7 @@ static int __devinit TLan_probe1(structTLanPrivateInfo *priv;u8 pci_rev;u16 device_id; -int reg; +int reg, ret;if (pdev &&pci_enable_device (pdev))return -EIO ;
@@ -513,7 +509,8 @@ static int __devinit TLan_probe1(struct dev =init_etherdev (NULL ,sizeof (TLanPrivateInfo));if (dev ==NULL ) {printk (KERN_ERR "TLAN: Could not allocate memory for device.\n" ); -return -ENOMEM ; + ret = -ENOMEM ; + goto err_out; }SET_MODULE_OWNER (dev);
@@ -537,9 +534,8 @@ static int __devinit TLan_probe1(struct }if (!pci_io_base) {printk (KERN_ERR "TLAN: No IO mappings available\n" ); -unregister_netdev (dev); -kfree (dev); -return -ENODEV ; + ret = -ENODEV ; + goto err_unregister_dev; } dev->base_addr = pci_io_base;
@@ -594,10 +590,9 @@ static int __devinit TLan_probe1(structif (TLan_Init (dev)) {printk (KERN_ERR "TLAN: Could not register device.\n" ); -unregister_netdev (dev); -kfree (dev); -return -EAGAIN ; - }else { + ret = -EAGAIN ; + goto err_unregister_dev; + } TLanDevicesInstalled++; boards_found++;
@@ -618,8 +613,12 @@ static int __devinit TLan_probe1(struct priv->adapter->deviceLabel, priv->adapterRev);return 0 ; - } +err_unregister_dev: +unregister_netdev (dev); +kfree (dev); +err_out: +return ret; }static void TLan_Release_Dev (struct net_device *dev)
PATCH 1/1 2.5.24 - drivers/net/tlan.c dma mapping 7/10
In reply to Jeff Garzik- private dma storage doesn't need room for Rx/Tx buffers anymore.
drivers/net/tlan.h +1 -0
@@ -42,6 +42,7 @@#define TLAN_NUM_RX_LISTS 32#define TLAN_NUM_TX_LISTS 64#define TLAN_NUM_ALL_LISTS (TLAN_NUM_RX_LISTS+TLAN_NUM_TX_LISTS) +#define TLAN_TOTAL_SIZE TLAN_NUM_ALL_LISTS*sizeof(TLanList)#define TLAN_IGNORE 0#define TLAN_RECORD 1
drivers/net/tlan.c +1 -7
@@ -813,13 +813,7 @@ static int TLan_Init( struct net_devicereturn -EIO ; } -if ( bbuf ) { - dma_size = (TLAN_NUM_RX_LISTS +TLAN_NUM_TX_LISTS ) - * (sizeof (TLanList) +TLAN_MAX_FRAME_SIZE ); - }else { - dma_size = (TLAN_NUM_RX_LISTS +TLAN_NUM_TX_LISTS ) - * (sizeof (TLanList) ); - } + dma_size =TLAN_TOTAL_SIZE ; priv->dmaStorage =kmalloc (dma_size,GFP_KERNEL |GFP_DMA );if ( priv->dmaStorage ==NULL ) { printk(KERN_ERR "TLAN: Could not allocate lists and buffers for %s.\n",
PATCH 1/1 2.5.24 - drivers/net/tlan.c dma mapping 10/10
In reply to Jeff Garzik- changelog update.
drivers/net/tlan.c +3 -1
@@ -164,6 +164,8 @@* v1.15 Apr 4, 2002 - Correct operation when aui=1 to be * 10T half duplex no loopback * Thanks to Gunnar Eikman +* +* v1.16 Jun 30, 2002 - DMA mapping conversion <[email protected]> *******************************************************************************/ #include <linux/module.h>
@@ -218,7 +220,7 @@ static int bbuf;static dma_addr_t TLanPadBuffer_dma;static u8 *TLanPadBuffer;static char TLanSignature[] ="TLAN" ; -static const char tlan_banner[] ="ThunderLAN driver v1.15\n" ; +static const char tlan_banner[] ="ThunderLAN driver v1.16\n" ;static int tlan_have_pci;static int tlan_have_eisa;
PATCH 1/1 2.5.24 - drivers/net/tlan.c dma mapping 2/10
In reply to Jeff Garzik- TLAN pad buffer virt_to_bus -> pci_map_single conversion.
drivers/net/tlan.c +7 -1
@@ -215,6 +215,7 @@ MODULE_PARM_DESC(bbuf, "ThunderLAN use bstatic int debug;static int bbuf; +static dma_addr_t TLanPadBuffer_dma;static u8 *TLanPadBuffer;static char TLanSignature[] ="TLAN" ;static const char tlan_banner[] ="ThunderLAN driver v1.15\n" ;
@@ -441,6 +442,9 @@ static int __init tlan_probe(void)printk (KERN_ERR "TLAN: Could not allocate memory for pad buffer.\n" );return -ENOMEM ; } + TLanPadBuffer_dma =pci_map_single (NULL , TLanPadBuffer, +TLAN_MIN_FRAME_SIZE ,PCI_DMA_TODEVICE ); +memset (TLanPadBuffer,0 ,TLAN_MIN_FRAME_SIZE ); pad_allocated =1 ;
@@ -647,6 +651,8 @@ static void __exit tlan_exit(void)if (tlan_have_eisa)TLan_Eisa_Cleanup (); +pci_unmap_single (NULL , TLanPadBuffer_dma,TLAN_MIN_FRAME_SIZE , +PCI_DMA_TODEVICE );kfree ( TLanPadBuffer );
@@ -1026,7 +1032,7 @@ static int TLan_StartTx( struct sk_buff tail_list->frameSize = (u16 ) skb->len + pad; tail_list->buffer[0 ].count = (u32 ) skb->len; tail_list->buffer[1 ].count =TLAN_LAST_BUFFER | (u32 ) pad; - tail_list->buffer[1 ].address =virt_to_bus ( TLanPadBuffer ); + tail_list->buffer[1 ].address = TLanPadBuffer_dma; }else { tail_list->frameSize = (u16 ) skb->len; tail_list->buffer[0 ].count =TLAN_LAST_BUFFER | (u32 ) skb->len;
PATCH 1/1 2.5.24 - drivers/net/tlan.c dma mapping 9/10
In reply to Jeff Garzik- (cosmetic) gotoize error paths in TLan_Init.
drivers/net/tlan.c +16 -11
@@ -805,11 +805,10 @@ static int TLan_Init( struct net_deviceif (!priv->is_eisa)/* EISA devices have already requested IO */ if (!request_region ( dev->base_addr,0x10 , TLanSignature )) { -printk (KERN_ERR "TLAN: %s: IO port region 0x%lx size 0x%x in use.\n" , - dev->name, - dev->base_addr, -0x10 ); -return -EIO ; +printk (KERN_ERR "%s: IO port region 0x%lx size 0x%x in use\n" , + dev->name, dev->base_addr,0x10 ); + err = -EIO ; + goto err_out; } dma_size =TLAN_TOTAL_SIZE ;
@@ -817,8 +816,8 @@ static int TLan_Init( struct net_deviceif (!addr) {printk (KERN_ERR "TLAN: Could not allocate lists and buffers for %s.\n" , dev->name ); -release_region ( dev->base_addr,0x10 ); -return -ENOMEM ; + err = -ENOMEM ; + goto err_out_release_region; }/* * pci_alloc_consistent and an adequate power of 2 for TLAN_NUM_RX_LISTS
@@ -833,10 +832,8 @@ static int TLan_Init( struct net_deviceif ( addr ==NULL ) {printk (KERN_ERR "%s: buffers allocation failed\n" , dev->name ); -pci_free_consistent (pdev,TLAN_TOTAL_SIZE , priv->rxList, - priv->lists_dma); -release_region ( dev->base_addr,0x10 ); -return -ENOMEM ; + err = -ENOMEM ; + goto err_out_free_consistent; }memset (addr,0 , dma_size ); priv->rxBuffer = (u8 *)addr;
@@ -874,6 +871,14 @@ static int TLan_Init( struct net_devicereturn 0 ; +err_out_free_consistent: +pci_free_consistent (pdev,TLAN_TOTAL_SIZE , priv->rxList, + priv->lists_dma); +err_out_release_region: +release_region ( dev->base_addr,0x10 ); +err_out: +return err; + }/* TLan_Init */