aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sungem.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-11-12 21:09:25 -0500
committerDavid S. Miller <davem@davemloft.net>2007-11-12 21:09:25 -0500
commit62768e28d606c10ba54217f908123de34dad9374 (patch)
treee245674de36746c80ec9ddd62e821d2244fbea5b /drivers/net/sungem.c
parentcd228d5458186f66bc36c4884f4f26ed955c5945 (diff)
[SUNGEM]: Fix suspend regression due to NAPI changes.
Commit bea3348e (the NAPI changes) made sungem unconditionally enable NAPI when resuming and unconditionally disable when suspending, this, however, makes napi_disable() hang when suspending when the interface was taken down before suspend because taking the interface down also disables NAPI. This patch makes touching the napi struct in suspend/resume code paths depend on having the interface up, thereby fixing the hang on suspend. The patch also moves the napi_disable() in gem_close() under the lock so that the NAPI state is always modified atomically together with the "opened" variable. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sungem.c')
-rw-r--r--drivers/net/sungem.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 53b8344a68ef..f6fedcc32de1 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -2333,10 +2333,10 @@ static int gem_close(struct net_device *dev)
2333{ 2333{
2334 struct gem *gp = dev->priv; 2334 struct gem *gp = dev->priv;
2335 2335
2336 napi_disable(&gp->napi);
2337
2338 mutex_lock(&gp->pm_mutex); 2336 mutex_lock(&gp->pm_mutex);
2339 2337
2338 napi_disable(&gp->napi);
2339
2340 gp->opened = 0; 2340 gp->opened = 0;
2341 if (!gp->asleep) 2341 if (!gp->asleep)
2342 gem_do_stop(dev, 0); 2342 gem_do_stop(dev, 0);
@@ -2355,8 +2355,6 @@ static int gem_suspend(struct pci_dev *pdev, pm_message_t state)
2355 2355
2356 mutex_lock(&gp->pm_mutex); 2356 mutex_lock(&gp->pm_mutex);
2357 2357
2358 napi_disable(&gp->napi);
2359
2360 printk(KERN_INFO "%s: suspending, WakeOnLan %s\n", 2358 printk(KERN_INFO "%s: suspending, WakeOnLan %s\n",
2361 dev->name, 2359 dev->name,
2362 (gp->wake_on_lan && gp->opened) ? "enabled" : "disabled"); 2360 (gp->wake_on_lan && gp->opened) ? "enabled" : "disabled");
@@ -2370,6 +2368,8 @@ static int gem_suspend(struct pci_dev *pdev, pm_message_t state)
2370 2368
2371 /* If the driver is opened, we stop the MAC */ 2369 /* If the driver is opened, we stop the MAC */
2372 if (gp->opened) { 2370 if (gp->opened) {
2371 napi_disable(&gp->napi);
2372
2373 /* Stop traffic, mark us closed */ 2373 /* Stop traffic, mark us closed */
2374 netif_device_detach(dev); 2374 netif_device_detach(dev);
2375 2375
@@ -2460,6 +2460,7 @@ static int gem_resume(struct pci_dev *pdev)
2460 /* Re-attach net device */ 2460 /* Re-attach net device */
2461 netif_device_attach(dev); 2461 netif_device_attach(dev);
2462 2462
2463 napi_enable(&gp->napi);
2463 } 2464 }
2464 2465
2465 spin_lock_irqsave(&gp->lock, flags); 2466 spin_lock_irqsave(&gp->lock, flags);
@@ -2479,8 +2480,6 @@ static int gem_resume(struct pci_dev *pdev)
2479 spin_unlock(&gp->tx_lock); 2480 spin_unlock(&gp->tx_lock);
2480 spin_unlock_irqrestore(&gp->lock, flags); 2481 spin_unlock_irqrestore(&gp->lock, flags);
2481 2482
2482 napi_enable(&gp->napi);
2483
2484 mutex_unlock(&gp->pm_mutex); 2483 mutex_unlock(&gp->pm_mutex);
2485 2484
2486 return 0; 2485 return 0;