All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] natsemi: Use round_jiffies() for slow timers
@ 2007-10-09 21:57 Mark Brown
  2007-10-09 21:57 ` [PATCH] natsemi: Use NATSEMI_TIMER_FREQ consistently Mark Brown
  2007-10-10  0:47 ` [PATCH] natsemi: Use round_jiffies() for slow timers Jeff Garzik
  0 siblings, 2 replies; 7+ messages in thread
From: Mark Brown @ 2007-10-09 21:57 UTC (permalink / raw)
  To: jgarzik, thockin; +Cc: netdev, linux-kernel, Mark Brown

Unless we have failed to fill the RX ring the timer used by the natsemi
driver is not particularly urgent and can use round_jiffies() to allow
grouping with other timers.

Signed-off-by: Mark Brown <broonie@sirena.org.uk>
---
 drivers/net/natsemi.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index b47a12d..0b33a58 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -1575,7 +1575,7 @@ static int netdev_open(struct net_device *dev)
 
 	/* Set the timer to check for link beat. */
 	init_timer(&np->timer);
-	np->timer.expires = jiffies + NATSEMI_TIMER_FREQ;
+	np->timer.expires = round_jiffies(jiffies + NATSEMI_TIMER_FREQ);
 	np->timer.data = (unsigned long)dev;
 	np->timer.function = &netdev_timer; /* timer handler */
 	add_timer(&np->timer);
@@ -1855,7 +1855,11 @@ static void netdev_timer(unsigned long data)
 			next_tick = 1;
 		}
 	}
-	mod_timer(&np->timer, jiffies + next_tick);
+
+	if (next_tick > 1)
+		mod_timer(&np->timer, round_jiffies(jiffies + next_tick));
+	else
+		mod_timer(&np->timer, jiffies + next_tick);
 }
 
 static void dump_ring(struct net_device *dev)
@@ -3330,7 +3334,7 @@ static int natsemi_resume (struct pci_dev *pdev)
 		spin_unlock_irq(&np->lock);
 		enable_irq(dev->irq);
 
-		mod_timer(&np->timer, jiffies + 1*HZ);
+		mod_timer(&np->timer, round_jiffies(jiffies + 1*HZ));
 	}
 	netif_device_attach(dev);
 	netif_poll_enable(dev);
-- 
1.5.3.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-10-15 18:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-09 21:57 [PATCH] natsemi: Use round_jiffies() for slow timers Mark Brown
2007-10-09 21:57 ` [PATCH] natsemi: Use NATSEMI_TIMER_FREQ consistently Mark Brown
2007-10-10  0:47   ` Jeff Garzik
2007-10-10  0:47 ` [PATCH] natsemi: Use round_jiffies() for slow timers Jeff Garzik
2007-10-10 10:05   ` Mark Brown
2007-10-10 16:11     ` [PATCH] natsemi: Check return value for pci_enable_device() Mark Brown
2007-10-15 18:21     ` [PATCH] natsemi: Use round_jiffies() for slow timers Jeff Garzik

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.