Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: LLC: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Hans Liljestrand <ishkamiel@gmail.com>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: "Reshetova, Elena" <elena.reshetova@intel.com>
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Kees Cook and committed by
David S. Miller
fc8bcaa0 8dbd05ff

+25 -22
+4 -4
include/net/llc_c_ac.h
··· 171 171 int llc_conn_ac_send_i_rsp_as_ack(struct sock *sk, struct sk_buff *skb); 172 172 int llc_conn_ac_send_i_as_ack(struct sock *sk, struct sk_buff *skb); 173 173 174 - void llc_conn_busy_tmr_cb(unsigned long timeout_data); 175 - void llc_conn_pf_cycle_tmr_cb(unsigned long timeout_data); 176 - void llc_conn_ack_tmr_cb(unsigned long timeout_data); 177 - void llc_conn_rej_tmr_cb(unsigned long timeout_data); 174 + void llc_conn_busy_tmr_cb(struct timer_list *t); 175 + void llc_conn_pf_cycle_tmr_cb(struct timer_list *t); 176 + void llc_conn_ack_tmr_cb(struct timer_list *t); 177 + void llc_conn_rej_tmr_cb(struct timer_list *t); 178 178 179 179 void llc_conn_set_p_flag(struct sock *sk, u8 value); 180 180 #endif /* LLC_C_AC_H */
+17 -10
net/llc/llc_c_ac.c
··· 1318 1318 return 0; 1319 1319 } 1320 1320 1321 - static void llc_conn_tmr_common_cb(unsigned long timeout_data, u8 type) 1321 + static void llc_conn_tmr_common_cb(struct sock *sk, u8 type) 1322 1322 { 1323 - struct sock *sk = (struct sock *)timeout_data; 1324 1323 struct sk_buff *skb = alloc_skb(0, GFP_ATOMIC); 1325 1324 1326 1325 bh_lock_sock(sk); ··· 1333 1334 bh_unlock_sock(sk); 1334 1335 } 1335 1336 1336 - void llc_conn_pf_cycle_tmr_cb(unsigned long timeout_data) 1337 + void llc_conn_pf_cycle_tmr_cb(struct timer_list *t) 1337 1338 { 1338 - llc_conn_tmr_common_cb(timeout_data, LLC_CONN_EV_TYPE_P_TMR); 1339 + struct llc_sock *llc = from_timer(llc, t, pf_cycle_timer.timer); 1340 + 1341 + llc_conn_tmr_common_cb(&llc->sk, LLC_CONN_EV_TYPE_P_TMR); 1339 1342 } 1340 1343 1341 - void llc_conn_busy_tmr_cb(unsigned long timeout_data) 1344 + void llc_conn_busy_tmr_cb(struct timer_list *t) 1342 1345 { 1343 - llc_conn_tmr_common_cb(timeout_data, LLC_CONN_EV_TYPE_BUSY_TMR); 1346 + struct llc_sock *llc = from_timer(llc, t, busy_state_timer.timer); 1347 + 1348 + llc_conn_tmr_common_cb(&llc->sk, LLC_CONN_EV_TYPE_BUSY_TMR); 1344 1349 } 1345 1350 1346 - void llc_conn_ack_tmr_cb(unsigned long timeout_data) 1351 + void llc_conn_ack_tmr_cb(struct timer_list *t) 1347 1352 { 1348 - llc_conn_tmr_common_cb(timeout_data, LLC_CONN_EV_TYPE_ACK_TMR); 1353 + struct llc_sock *llc = from_timer(llc, t, ack_timer.timer); 1354 + 1355 + llc_conn_tmr_common_cb(&llc->sk, LLC_CONN_EV_TYPE_ACK_TMR); 1349 1356 } 1350 1357 1351 - void llc_conn_rej_tmr_cb(unsigned long timeout_data) 1358 + void llc_conn_rej_tmr_cb(struct timer_list *t) 1352 1359 { 1353 - llc_conn_tmr_common_cb(timeout_data, LLC_CONN_EV_TYPE_REJ_TMR); 1360 + struct llc_sock *llc = from_timer(llc, t, rej_sent_timer.timer); 1361 + 1362 + llc_conn_tmr_common_cb(&llc->sk, LLC_CONN_EV_TYPE_REJ_TMR); 1354 1363 } 1355 1364 1356 1365 int llc_conn_ac_rst_vs(struct sock *sk, struct sk_buff *skb)
+4 -8
net/llc/llc_conn.c
··· 902 902 llc->inc_cntr = llc->dec_cntr = 2; 903 903 llc->dec_step = llc->connect_step = 1; 904 904 905 - setup_timer(&llc->ack_timer.timer, llc_conn_ack_tmr_cb, 906 - (unsigned long)sk); 905 + timer_setup(&llc->ack_timer.timer, llc_conn_ack_tmr_cb, 0); 907 906 llc->ack_timer.expire = sysctl_llc2_ack_timeout; 908 907 909 - setup_timer(&llc->pf_cycle_timer.timer, llc_conn_pf_cycle_tmr_cb, 910 - (unsigned long)sk); 908 + timer_setup(&llc->pf_cycle_timer.timer, llc_conn_pf_cycle_tmr_cb, 0); 911 909 llc->pf_cycle_timer.expire = sysctl_llc2_p_timeout; 912 910 913 - setup_timer(&llc->rej_sent_timer.timer, llc_conn_rej_tmr_cb, 914 - (unsigned long)sk); 911 + timer_setup(&llc->rej_sent_timer.timer, llc_conn_rej_tmr_cb, 0); 915 912 llc->rej_sent_timer.expire = sysctl_llc2_rej_timeout; 916 913 917 - setup_timer(&llc->busy_state_timer.timer, llc_conn_busy_tmr_cb, 918 - (unsigned long)sk); 914 + timer_setup(&llc->busy_state_timer.timer, llc_conn_busy_tmr_cb, 0); 919 915 llc->busy_state_timer.expire = sysctl_llc2_busy_timeout; 920 916 921 917 llc->n2 = 2; /* max retransmit */