tms380tr patch 1/3 (bug fix)
Hi Jeff,
this fixes some problems partly introduced in the latest token ring update:
- mix of alloc_trdev(0) and alloc_trdev(sizeof(struct net_local)) confused memory management.
- initialization of proteon and sknet cards was broken.
- proteon_close() and skisa_close() deleted.
--jochen
abyss.c | 2 - madgemc.c | 2 - proteon.c | 91 ++++++++++++++++++++++++------------------------------- skisa.c | 100 +++++++++++++++++++++++++------------------------------------ tms380tr.c | 41 +++++++++---------------- tmspci.c | 2 - 6 files changed, 100 insertions(+), 138 deletions(-)
net/tokenring/tms380tr.c +15 -26
@@ -246,6 +246,7 @@ int tms380tr_open(struct net_device *dev/* init the spinlock */ spin_lock_init (&tp->lock); +init_timer (&tp->timer);/* Reset the hardware here. Don't forget to set the station address. */
@@ -266,7 +267,6 @@ int tms380tr_open(struct net_device *devreturn (-1 ); } -init_timer (&tp->timer); tp->timer.expires = jiffies +30 *HZ ; tp->timer.function = tms380tr_timer_end_wait; tp->timer.data = (unsigned long )dev;
@@ -2342,37 +2342,26 @@ void tmsdev_term(struct net_device *dev) tp = (struct net_local *) dev->priv;pci_unmap_single (tp->pdev, tp->dmabuffer,sizeof (struct net_local ),PCI_DMA_BIDIRECTIONAL ); -kfree (dev->priv); }int tmsdev_init (struct net_device *dev,unsigned long dmalimit,struct pci_dev *pdev) { -if (dev->priv ==NULL ) +struct net_local *tms_local; + +memset (dev->priv,0 ,sizeof (struct net_local )); + tms_local = (struct net_local *)dev->priv; +init_waitqueue_head (&tms_local->wait_for_tok_int); + tms_local->dmalimit = dmalimit; + tms_local->pdev = pdev; + tms_local->dmabuffer =pci_map_single (pdev, (void *)tms_local, +sizeof (struct net_local ),PCI_DMA_BIDIRECTIONAL ); +if (tms_local->dmabuffer +sizeof (struct net_local ) > dmalimit) { -struct net_local *tms_local; - - dev->priv =kmalloc (sizeof (struct net_local ),GFP_KERNEL |GFP_DMA ); -if (dev->priv ==NULL ) - { -printk (KERN_INFO "%s: Out of memory for DMA\n" , - dev->name); -return -ENOMEM ; - } -memset (dev->priv,0 ,sizeof (struct net_local )); - tms_local = (struct net_local *)dev->priv; -init_waitqueue_head (&tms_local->wait_for_tok_int); - tms_local->dmalimit = dmalimit; - tms_local->pdev = pdev; - tms_local->dmabuffer =pci_map_single (pdev, (void *)tms_local, -sizeof (struct net_local ),PCI_DMA_BIDIRECTIONAL ); -if (tms_local->dmabuffer +sizeof (struct net_local ) > dmalimit) - { -printk (KERN_INFO "%s: Memory not accessible for DMA\n" , - dev->name); -tmsdev_term (dev); -return -ENOMEM ; - } +printk (KERN_INFO "%s: Memory not accessible for DMA\n" , + dev->name); +tmsdev_term (dev); +return -ENOMEM ; }/* These can be overridden by the card driver if needed */
net/tokenring/proteon.c +40 -51
147 lines not on this page · raw message
net/tokenring/skisa.c +42 -58
164 lines not on this page · raw message
net/tokenring/tmspci.c +1 -1
@@ -112,7 +112,7 @@ static int __devinit tms_pci_attach(stru pci_ioaddr =pci_resource_start (pdev,0 );/* At this point we have found a valid card. */ - dev =alloc_trdev (0 ); + dev =alloc_trdev (sizeof (struct net_local ));if (!dev)return -ENOMEM ;SET_MODULE_OWNER (dev);
net/tokenring/abyss.c +1 -1
@@ -112,7 +112,7 @@ static int __devinit abyss_attach(struct/* At this point we have found a valid card. */ - dev =alloc_trdev (0 ); + dev =alloc_trdev (sizeof (struct net_local ));if (!dev)return -ENOMEM ;
net/tokenring/madgemc.c +1 -1
@@ -177,7 +177,7 @@ static int __init madgemc_probe(void)if (versionprinted++ ==0 )printk ("%s" , version); - dev =alloc_trdev (0 ); + dev =alloc_trdev (sizeof (struct net_local ));if (dev ==NULL ) {printk ("madgemc: unable to allocate dev space\n" );if (madgemc_card_list)
net/tokenring/tms380tr.c
Quoted 3 lines · Jochen Friedrich
diff -u -p -r1.17
tms380tr.cnet/tokenring/tms380tr.c +0
-0
I am OK with all your patches (especially happy to see firmware go away!), but they need to be in the form that scripts can apply them with "patch -sp1". Please resend your 4 patches in this manner.
Thanks,
Jeff