diff options
Diffstat (limited to 'drivers/net/natsemi.c')
-rw-r--r-- | drivers/net/natsemi.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c index 527f9dcc7f69..50e1ec67ef9c 100644 --- a/drivers/net/natsemi.c +++ b/drivers/net/natsemi.c | |||
@@ -1576,7 +1576,7 @@ static int netdev_open(struct net_device *dev) | |||
1576 | 1576 | ||
1577 | /* Set the timer to check for link beat. */ | 1577 | /* Set the timer to check for link beat. */ |
1578 | init_timer(&np->timer); | 1578 | init_timer(&np->timer); |
1579 | np->timer.expires = jiffies + NATSEMI_TIMER_FREQ; | 1579 | np->timer.expires = round_jiffies(jiffies + NATSEMI_TIMER_FREQ); |
1580 | np->timer.data = (unsigned long)dev; | 1580 | np->timer.data = (unsigned long)dev; |
1581 | np->timer.function = &netdev_timer; /* timer handler */ | 1581 | np->timer.function = &netdev_timer; /* timer handler */ |
1582 | add_timer(&np->timer); | 1582 | add_timer(&np->timer); |
@@ -1856,7 +1856,11 @@ static void netdev_timer(unsigned long data) | |||
1856 | next_tick = 1; | 1856 | next_tick = 1; |
1857 | } | 1857 | } |
1858 | } | 1858 | } |
1859 | mod_timer(&np->timer, jiffies + next_tick); | 1859 | |
1860 | if (next_tick > 1) | ||
1861 | mod_timer(&np->timer, round_jiffies(jiffies + next_tick)); | ||
1862 | else | ||
1863 | mod_timer(&np->timer, jiffies + next_tick); | ||
1860 | } | 1864 | } |
1861 | 1865 | ||
1862 | static void dump_ring(struct net_device *dev) | 1866 | static void dump_ring(struct net_device *dev) |
@@ -3310,13 +3314,19 @@ static int natsemi_resume (struct pci_dev *pdev) | |||
3310 | { | 3314 | { |
3311 | struct net_device *dev = pci_get_drvdata (pdev); | 3315 | struct net_device *dev = pci_get_drvdata (pdev); |
3312 | struct netdev_private *np = netdev_priv(dev); | 3316 | struct netdev_private *np = netdev_priv(dev); |
3317 | int ret = 0; | ||
3313 | 3318 | ||
3314 | rtnl_lock(); | 3319 | rtnl_lock(); |
3315 | if (netif_device_present(dev)) | 3320 | if (netif_device_present(dev)) |
3316 | goto out; | 3321 | goto out; |
3317 | if (netif_running(dev)) { | 3322 | if (netif_running(dev)) { |
3318 | BUG_ON(!np->hands_off); | 3323 | BUG_ON(!np->hands_off); |
3319 | pci_enable_device(pdev); | 3324 | ret = pci_enable_device(pdev); |
3325 | if (ret < 0) { | ||
3326 | dev_err(&pdev->dev, | ||
3327 | "pci_enable_device() failed: %d\n", ret); | ||
3328 | goto out; | ||
3329 | } | ||
3320 | /* pci_power_on(pdev); */ | 3330 | /* pci_power_on(pdev); */ |
3321 | 3331 | ||
3322 | napi_enable(&np->napi); | 3332 | napi_enable(&np->napi); |
@@ -3331,12 +3341,12 @@ static int natsemi_resume (struct pci_dev *pdev) | |||
3331 | spin_unlock_irq(&np->lock); | 3341 | spin_unlock_irq(&np->lock); |
3332 | enable_irq(dev->irq); | 3342 | enable_irq(dev->irq); |
3333 | 3343 | ||
3334 | mod_timer(&np->timer, jiffies + 1*HZ); | 3344 | mod_timer(&np->timer, round_jiffies(jiffies + 1*HZ)); |
3335 | } | 3345 | } |
3336 | netif_device_attach(dev); | 3346 | netif_device_attach(dev); |
3337 | out: | 3347 | out: |
3338 | rtnl_unlock(); | 3348 | rtnl_unlock(); |
3339 | return 0; | 3349 | return ret; |
3340 | } | 3350 | } |
3341 | 3351 | ||
3342 | #endif /* CONFIG_PM */ | 3352 | #endif /* CONFIG_PM */ |