aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFinn Thain <fthain@telegraphics.com.au>2007-05-01 16:33:02 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-04 20:59:08 -0400
commitd74472f0b2553e59eafb7feee0ff9558136a17e0 (patch)
tree38d85faf098e7c5b1e41dc23ea6c9044f8ae3e91
parent8b6aaab8c8bdbe011aac79af218dd1e657984bab (diff)
SONIC: small fix and cleanup
Fix a potential problem in the timeout handling: don't free the DMA buffers before resetting the chip. Also a trivial cleanup. Bring macsonic and jazzsonic into sync. Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/net/jazzsonic.c4
-rw-r--r--drivers/net/macsonic.c17
-rw-r--r--drivers/net/sonic.c7
3 files changed, 16 insertions, 12 deletions
diff --git a/drivers/net/jazzsonic.c b/drivers/net/jazzsonic.c
index d34afb52ea7f..1a73630fd7d5 100644
--- a/drivers/net/jazzsonic.c
+++ b/drivers/net/jazzsonic.c
@@ -269,11 +269,11 @@ static int __devexit jazz_sonic_device_remove (struct platform_device *pdev)
269 struct net_device *dev = platform_get_drvdata(pdev); 269 struct net_device *dev = platform_get_drvdata(pdev);
270 struct sonic_local* lp = netdev_priv(dev); 270 struct sonic_local* lp = netdev_priv(dev);
271 271
272 unregister_netdev (dev); 272 unregister_netdev(dev);
273 dma_free_coherent(lp->device, SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode), 273 dma_free_coherent(lp->device, SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
274 lp->descriptors, lp->descriptors_laddr); 274 lp->descriptors, lp->descriptors_laddr);
275 release_region (dev->base_addr, SONIC_MEM_SIZE); 275 release_region (dev->base_addr, SONIC_MEM_SIZE);
276 free_netdev (dev); 276 free_netdev(dev);
277 277
278 return 0; 278 return 0;
279} 279}
diff --git a/drivers/net/macsonic.c b/drivers/net/macsonic.c
index a3d24a39b5f1..c78a7e2e8ba8 100644
--- a/drivers/net/macsonic.c
+++ b/drivers/net/macsonic.c
@@ -522,7 +522,7 @@ int __init mac_nubus_sonic_probe(struct net_device* dev)
522 return macsonic_init(dev); 522 return macsonic_init(dev);
523} 523}
524 524
525static int __init mac_sonic_probe(struct platform_device *device) 525static int __init mac_sonic_probe(struct platform_device *pdev)
526{ 526{
527 struct net_device *dev; 527 struct net_device *dev;
528 struct sonic_local *lp; 528 struct sonic_local *lp;
@@ -534,8 +534,8 @@ static int __init mac_sonic_probe(struct platform_device *device)
534 return -ENOMEM; 534 return -ENOMEM;
535 535
536 lp = netdev_priv(dev); 536 lp = netdev_priv(dev);
537 lp->device = &device->dev; 537 lp->device = &pdev->dev;
538 SET_NETDEV_DEV(dev, &device->dev); 538 SET_NETDEV_DEV(dev, &pdev->dev);
539 SET_MODULE_OWNER(dev); 539 SET_MODULE_OWNER(dev);
540 540
541 /* This will catch fatal stuff like -ENOMEM as well as success */ 541 /* This will catch fatal stuff like -ENOMEM as well as success */
@@ -576,15 +576,15 @@ MODULE_PARM_DESC(sonic_debug, "macsonic debug level (1-4)");
576 576
577#include "sonic.c" 577#include "sonic.c"
578 578
579static int __devexit mac_sonic_device_remove (struct platform_device *device) 579static int __devexit mac_sonic_device_remove (struct platform_device *pdev)
580{ 580{
581 struct net_device *dev = platform_get_drvdata(device); 581 struct net_device *dev = platform_get_drvdata(pdev);
582 struct sonic_local* lp = netdev_priv(dev); 582 struct sonic_local* lp = netdev_priv(dev);
583 583
584 unregister_netdev (dev); 584 unregister_netdev(dev);
585 dma_free_coherent(lp->device, SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode), 585 dma_free_coherent(lp->device, SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
586 lp->descriptors, lp->descriptors_laddr); 586 lp->descriptors, lp->descriptors_laddr);
587 free_netdev (dev); 587 free_netdev(dev);
588 588
589 return 0; 589 return 0;
590} 590}
@@ -607,9 +607,8 @@ static int __init mac_sonic_init_module(void)
607 } 607 }
608 608
609 mac_sonic_device = platform_device_alloc(mac_sonic_string, 0); 609 mac_sonic_device = platform_device_alloc(mac_sonic_string, 0);
610 if (!mac_sonic_device) { 610 if (!mac_sonic_device)
611 goto out_unregister; 611 goto out_unregister;
612 }
613 612
614 if (platform_device_add(mac_sonic_device)) { 613 if (platform_device_add(mac_sonic_device)) {
615 platform_device_put(mac_sonic_device); 614 platform_device_put(mac_sonic_device);
diff --git a/drivers/net/sonic.c b/drivers/net/sonic.c
index c6320c719931..687c1413c4ee 100644
--- a/drivers/net/sonic.c
+++ b/drivers/net/sonic.c
@@ -178,8 +178,13 @@ static void sonic_tx_timeout(struct net_device *dev)
178{ 178{
179 struct sonic_local *lp = netdev_priv(dev); 179 struct sonic_local *lp = netdev_priv(dev);
180 int i; 180 int i;
181 /* Stop the interrupts for this */ 181 /*
182 * put the Sonic into software-reset mode and
183 * disable all interrupts before releasing DMA buffers
184 */
182 SONIC_WRITE(SONIC_IMR, 0); 185 SONIC_WRITE(SONIC_IMR, 0);
186 SONIC_WRITE(SONIC_ISR, 0x7fff);
187 SONIC_WRITE(SONIC_CMD, SONIC_CR_RST);
183 /* We could resend the original skbs. Easier to re-initialise. */ 188 /* We could resend the original skbs. Easier to re-initialise. */
184 for (i = 0; i < SONIC_NUM_TDS; i++) { 189 for (i = 0; i < SONIC_NUM_TDS; i++) {
185 if(lp->tx_laddr[i]) { 190 if(lp->tx_laddr[i]) {