aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/link_watch.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2012-08-21 13:18:24 -0700
committerTejun Heo <tj@kernel.org>2012-08-21 13:18:24 -0700
commite7c2f967445dd2041f0f8e3179cca22bb8bb7f79 (patch)
treecb6c1d3593d2497e740d313f55592f41e8ae2039 /net/core/link_watch.c
parentworkqueue: use irqsafe timer for delayed_work (diff)
downloadlinux-dev-e7c2f967445dd2041f0f8e3179cca22bb8bb7f79.tar.xz
linux-dev-e7c2f967445dd2041f0f8e3179cca22bb8bb7f79.zip
workqueue: use mod_delayed_work() instead of __cancel + queue
Now that mod_delayed_work() is safe to call from IRQ handlers, __cancel_delayed_work() followed by queue_delayed_work() can be replaced with mod_delayed_work(). Most conversions are straight-forward except for the following. * net/core/link_watch.c: linkwatch_schedule_work() was doing a quite elaborate dancing around its delayed_work. Collapse it such that linkwatch_work is queued for immediate execution if LW_URGENT and existing timer is kept otherwise. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: "David S. Miller" <davem@davemloft.net> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'net/core/link_watch.c')
-rw-r--r--net/core/link_watch.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/net/core/link_watch.c b/net/core/link_watch.c
index c3519c6d1b16..8e397a69005a 100644
--- a/net/core/link_watch.c
+++ b/net/core/link_watch.c
@@ -120,22 +120,13 @@ static void linkwatch_schedule_work(int urgent)
delay = 0;
/*
- * This is true if we've scheduled it immeditately or if we don't
- * need an immediate execution and it's already pending.
+ * If urgent, schedule immediate execution; otherwise, don't
+ * override the existing timer.
*/
- if (schedule_delayed_work(&linkwatch_work, delay) == !delay)
- return;
-
- /* Don't bother if there is nothing urgent. */
- if (!test_bit(LW_URGENT, &linkwatch_flags))
- return;
-
- /* It's already running which is good enough. */
- if (!__cancel_delayed_work(&linkwatch_work))
- return;
-
- /* Otherwise we reschedule it again for immediate execution. */
- schedule_delayed_work(&linkwatch_work, 0);
+ if (test_bit(LW_URGENT, &linkwatch_flags))
+ mod_delayed_work(system_wq, &linkwatch_work, 0);
+ else
+ schedule_delayed_work(&linkwatch_work, delay);
}