Commit 9f12a77e authored by Kees Cook's avatar Kees Cook Committed by David S. Miller

net/core: Collapse redundant sk_timer callback data assignments

The core sk_timer initializer can provide the common .data assignment
instead of it being set separately in users.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Andrew Hendry <andrew.hendry@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Colin Ian King <colin.king@canonical.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: linzhang <xiaolou4617@gmail.com>
Cc: netdev@vger.kernel.org
Cc: linux-hams@vger.kernel.org
Cc: linux-x25@vger.kernel.org
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 78802011
...@@ -2683,7 +2683,7 @@ void sock_init_data(struct socket *sock, struct sock *sk) ...@@ -2683,7 +2683,7 @@ void sock_init_data(struct socket *sock, struct sock *sk)
sk_init_common(sk); sk_init_common(sk);
sk->sk_send_head = NULL; sk->sk_send_head = NULL;
init_timer(&sk->sk_timer); setup_timer(&sk->sk_timer, NULL, (unsigned long)sk);
sk->sk_allocation = GFP_KERNEL; sk->sk_allocation = GFP_KERNEL;
sk->sk_rcvbuf = sysctl_rmem_default; sk->sk_rcvbuf = sysctl_rmem_default;
......
...@@ -45,7 +45,6 @@ void nr_init_timers(struct sock *sk) ...@@ -45,7 +45,6 @@ void nr_init_timers(struct sock *sk)
setup_timer(&nr->idletimer, nr_idletimer_expiry, (unsigned long)sk); setup_timer(&nr->idletimer, nr_idletimer_expiry, (unsigned long)sk);
/* initialized by sock_init_data */ /* initialized by sock_init_data */
sk->sk_timer.data = (unsigned long)sk;
sk->sk_timer.function = &nr_heartbeat_expiry; sk->sk_timer.function = &nr_heartbeat_expiry;
} }
......
...@@ -36,7 +36,6 @@ void rose_start_heartbeat(struct sock *sk) ...@@ -36,7 +36,6 @@ void rose_start_heartbeat(struct sock *sk)
{ {
del_timer(&sk->sk_timer); del_timer(&sk->sk_timer);
sk->sk_timer.data = (unsigned long)sk;
sk->sk_timer.function = &rose_heartbeat_expiry; sk->sk_timer.function = &rose_heartbeat_expiry;
sk->sk_timer.expires = jiffies + 5 * HZ; sk->sk_timer.expires = jiffies + 5 * HZ;
......
...@@ -414,7 +414,6 @@ static void __x25_destroy_socket(struct sock *sk) ...@@ -414,7 +414,6 @@ static void __x25_destroy_socket(struct sock *sk)
/* Defer: outstanding buffers */ /* Defer: outstanding buffers */
sk->sk_timer.expires = jiffies + 10 * HZ; sk->sk_timer.expires = jiffies + 10 * HZ;
sk->sk_timer.function = x25_destroy_timer; sk->sk_timer.function = x25_destroy_timer;
sk->sk_timer.data = (unsigned long)sk;
add_timer(&sk->sk_timer); add_timer(&sk->sk_timer);
} else { } else {
/* drop last reference so sock_put will free */ /* drop last reference so sock_put will free */
......
...@@ -36,7 +36,6 @@ void x25_init_timers(struct sock *sk) ...@@ -36,7 +36,6 @@ void x25_init_timers(struct sock *sk)
setup_timer(&x25->timer, x25_timer_expiry, (unsigned long)sk); setup_timer(&x25->timer, x25_timer_expiry, (unsigned long)sk);
/* initialized by sock_init_data */ /* initialized by sock_init_data */
sk->sk_timer.data = (unsigned long)sk;
sk->sk_timer.function = &x25_heartbeat_expiry; sk->sk_timer.function = &x25_heartbeat_expiry;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment