diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-01-24 00:20:07 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:53:35 -0500 |
commit | b24b8a247ff65c01b252025926fe564209fae4fc (patch) | |
tree | 8a9e0ea1e24b4733d8b9433d41877659505e9da4 /net/ipv4/ipvs | |
parent | a92aa318b4b369091fd80433c80e62838db8bc1c (diff) |
[NET]: Convert init_timer into setup_timer
Many-many code in the kernel initialized the timer->function
and timer->data together with calling init_timer(timer). There
is already a helper for this. Use it for networking code.
The patch is HUGE, but makes the code 130 lines shorter
(98 insertions(+), 228 deletions(-)).
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ipvs')
-rw-r--r-- | net/ipv4/ipvs/ip_vs_conn.c | 4 | ||||
-rw-r--r-- | net/ipv4/ipvs/ip_vs_est.c | 3 | ||||
-rw-r--r-- | net/ipv4/ipvs/ip_vs_lblc.c | 5 | ||||
-rw-r--r-- | net/ipv4/ipvs/ip_vs_lblcr.c | 5 |
4 files changed, 6 insertions, 11 deletions
diff --git a/net/ipv4/ipvs/ip_vs_conn.c b/net/ipv4/ipvs/ip_vs_conn.c index 0a9f3c37e18d..a22cee43ed7c 100644 --- a/net/ipv4/ipvs/ip_vs_conn.c +++ b/net/ipv4/ipvs/ip_vs_conn.c | |||
@@ -629,9 +629,7 @@ ip_vs_conn_new(int proto, __be32 caddr, __be16 cport, __be32 vaddr, __be16 vport | |||
629 | } | 629 | } |
630 | 630 | ||
631 | INIT_LIST_HEAD(&cp->c_list); | 631 | INIT_LIST_HEAD(&cp->c_list); |
632 | init_timer(&cp->timer); | 632 | setup_timer(&cp->timer, ip_vs_conn_expire, (unsigned long)cp); |
633 | cp->timer.data = (unsigned long)cp; | ||
634 | cp->timer.function = ip_vs_conn_expire; | ||
635 | cp->protocol = proto; | 633 | cp->protocol = proto; |
636 | cp->caddr = caddr; | 634 | cp->caddr = caddr; |
637 | cp->cport = cport; | 635 | cp->cport = cport; |
diff --git a/net/ipv4/ipvs/ip_vs_est.c b/net/ipv4/ipvs/ip_vs_est.c index 7d68b80c4c19..efdd74e4fa28 100644 --- a/net/ipv4/ipvs/ip_vs_est.c +++ b/net/ipv4/ipvs/ip_vs_est.c | |||
@@ -146,9 +146,8 @@ int ip_vs_new_estimator(struct ip_vs_stats *stats) | |||
146 | write_lock_bh(&est_lock); | 146 | write_lock_bh(&est_lock); |
147 | est->next = est_list; | 147 | est->next = est_list; |
148 | if (est->next == NULL) { | 148 | if (est->next == NULL) { |
149 | init_timer(&est_timer); | 149 | setup_timer(&est_timer, estimation_timer, 0); |
150 | est_timer.expires = jiffies + 2*HZ; | 150 | est_timer.expires = jiffies + 2*HZ; |
151 | est_timer.function = estimation_timer; | ||
152 | add_timer(&est_timer); | 151 | add_timer(&est_timer); |
153 | } | 152 | } |
154 | est_list = est; | 153 | est_list = est; |
diff --git a/net/ipv4/ipvs/ip_vs_lblc.c b/net/ipv4/ipvs/ip_vs_lblc.c index ad89644ef5d2..bf8c04a57548 100644 --- a/net/ipv4/ipvs/ip_vs_lblc.c +++ b/net/ipv4/ipvs/ip_vs_lblc.c | |||
@@ -391,9 +391,8 @@ static int ip_vs_lblc_init_svc(struct ip_vs_service *svc) | |||
391 | /* | 391 | /* |
392 | * Hook periodic timer for garbage collection | 392 | * Hook periodic timer for garbage collection |
393 | */ | 393 | */ |
394 | init_timer(&tbl->periodic_timer); | 394 | setup_timer(&tbl->periodic_timer, ip_vs_lblc_check_expire, |
395 | tbl->periodic_timer.data = (unsigned long)tbl; | 395 | (unsigned long)tbl); |
396 | tbl->periodic_timer.function = ip_vs_lblc_check_expire; | ||
397 | tbl->periodic_timer.expires = jiffies+CHECK_EXPIRE_INTERVAL; | 396 | tbl->periodic_timer.expires = jiffies+CHECK_EXPIRE_INTERVAL; |
398 | add_timer(&tbl->periodic_timer); | 397 | add_timer(&tbl->periodic_timer); |
399 | 398 | ||
diff --git a/net/ipv4/ipvs/ip_vs_lblcr.c b/net/ipv4/ipvs/ip_vs_lblcr.c index 2a5ed85a3352..f50da6411378 100644 --- a/net/ipv4/ipvs/ip_vs_lblcr.c +++ b/net/ipv4/ipvs/ip_vs_lblcr.c | |||
@@ -575,9 +575,8 @@ static int ip_vs_lblcr_init_svc(struct ip_vs_service *svc) | |||
575 | /* | 575 | /* |
576 | * Hook periodic timer for garbage collection | 576 | * Hook periodic timer for garbage collection |
577 | */ | 577 | */ |
578 | init_timer(&tbl->periodic_timer); | 578 | setup_timer(&tbl->periodic_timer, ip_vs_lblcr_check_expire, |
579 | tbl->periodic_timer.data = (unsigned long)tbl; | 579 | (unsigned long)tbl); |
580 | tbl->periodic_timer.function = ip_vs_lblcr_check_expire; | ||
581 | tbl->periodic_timer.expires = jiffies+CHECK_EXPIRE_INTERVAL; | 580 | tbl->periodic_timer.expires = jiffies+CHECK_EXPIRE_INTERVAL; |
582 | add_timer(&tbl->periodic_timer); | 581 | add_timer(&tbl->periodic_timer); |
583 | 582 | ||