]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/core/link_watch.c
Merge master.kernel.org:/home/rmk/linux-2.6-arm
[linux-2.6-omap-h63xx.git] / net / core / link_watch.c
index 341de44c7ed1e884f1d036ff74c94d884f6714ea..4b36114744c57f983c8af674ee45610f6e830ac1 100644 (file)
@@ -11,7 +11,6 @@
  *
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/netdevice.h>
 #include <linux/if.h>
@@ -91,11 +90,10 @@ static void rfc2863_policy(struct net_device *dev)
 /* Must be called with the rtnl semaphore held */
 void linkwatch_run_queue(void)
 {
-       LIST_HEAD(head);
-       struct list_head *n, *next;
+       struct list_head head, *n, *next;
 
        spin_lock_irq(&lweventlist_lock);
-       list_splice_init(&lweventlist, &head);
+       list_replace_init(&lweventlist, &head);
        spin_unlock_irq(&lweventlist_lock);
 
        list_for_each_safe(n, next, &head) {
@@ -170,13 +168,13 @@ void linkwatch_fire_event(struct net_device *dev)
                spin_unlock_irqrestore(&lweventlist_lock, flags);
 
                if (!test_and_set_bit(LW_RUNNING, &linkwatch_flags)) {
-                       unsigned long thisevent = jiffies;
+                       unsigned long delay = linkwatch_nextevent - jiffies;
 
-                       if (thisevent >= linkwatch_nextevent) {
+                       /* If we wrap around we'll delay it by at most HZ. */
+                       if (!delay || delay > HZ)
                                schedule_work(&linkwatch_work);
-                       } else {
-                               schedule_delayed_work(&linkwatch_work, linkwatch_nextevent - thisevent);
-                       }
+                       else
+                               schedule_delayed_work(&linkwatch_work, delay);
                }
        }
 }