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

net: ax25: 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: Joerg Reuter <jreuter@yaina.de>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: linux-hams@vger.kernel.org
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
8dbd05ff 9c3b5751

+27 -30
+3 -4
net/ax25/af_ax25.c
··· 268 268 /* 269 269 * Handler for deferred kills. 270 270 */ 271 - static void ax25_destroy_timer(unsigned long data) 271 + static void ax25_destroy_timer(struct timer_list *t) 272 272 { 273 - ax25_cb *ax25=(ax25_cb *)data; 273 + ax25_cb *ax25 = from_timer(ax25, t, dtimer); 274 274 struct sock *sk; 275 275 276 276 sk=ax25->sk; ··· 326 326 if (ax25->sk != NULL) { 327 327 if (sk_has_allocations(ax25->sk)) { 328 328 /* Defer: outstanding buffers */ 329 - setup_timer(&ax25->dtimer, ax25_destroy_timer, 330 - (unsigned long)ax25); 329 + timer_setup(&ax25->dtimer, ax25_destroy_timer, 0); 331 330 ax25->dtimer.expires = jiffies + 2 * HZ; 332 331 add_timer(&ax25->dtimer); 333 332 } else {
+4 -5
net/ax25/ax25_ds_timer.c
··· 29 29 #include <linux/mm.h> 30 30 #include <linux/interrupt.h> 31 31 32 - static void ax25_ds_timeout(unsigned long); 32 + static void ax25_ds_timeout(struct timer_list *); 33 33 34 34 /* 35 35 * Add DAMA slave timeout timer to timer list. ··· 41 41 42 42 void ax25_ds_setup_timer(ax25_dev *ax25_dev) 43 43 { 44 - setup_timer(&ax25_dev->dama.slave_timer, ax25_ds_timeout, 45 - (unsigned long)ax25_dev); 44 + timer_setup(&ax25_dev->dama.slave_timer, ax25_ds_timeout, 0); 46 45 } 47 46 48 47 void ax25_ds_del_timer(ax25_dev *ax25_dev) ··· 65 66 * Silently discard all (slave) connections in case our master forgot us... 66 67 */ 67 68 68 - static void ax25_ds_timeout(unsigned long arg) 69 + static void ax25_ds_timeout(struct timer_list *t) 69 70 { 70 - ax25_dev *ax25_dev = (struct ax25_dev *) arg; 71 + ax25_dev *ax25_dev = from_timer(ax25_dev, t, dama.slave_timer); 71 72 ax25_cb *ax25; 72 73 73 74 if (ax25_dev == NULL || !ax25_dev->dama.slave)
+20 -21
net/ax25/ax25_timer.c
··· 33 33 #include <linux/mm.h> 34 34 #include <linux/interrupt.h> 35 35 36 - static void ax25_heartbeat_expiry(unsigned long); 37 - static void ax25_t1timer_expiry(unsigned long); 38 - static void ax25_t2timer_expiry(unsigned long); 39 - static void ax25_t3timer_expiry(unsigned long); 40 - static void ax25_idletimer_expiry(unsigned long); 36 + static void ax25_heartbeat_expiry(struct timer_list *); 37 + static void ax25_t1timer_expiry(struct timer_list *); 38 + static void ax25_t2timer_expiry(struct timer_list *); 39 + static void ax25_t3timer_expiry(struct timer_list *); 40 + static void ax25_idletimer_expiry(struct timer_list *); 41 41 42 42 void ax25_setup_timers(ax25_cb *ax25) 43 43 { 44 - setup_timer(&ax25->timer, ax25_heartbeat_expiry, (unsigned long)ax25); 45 - setup_timer(&ax25->t1timer, ax25_t1timer_expiry, (unsigned long)ax25); 46 - setup_timer(&ax25->t2timer, ax25_t2timer_expiry, (unsigned long)ax25); 47 - setup_timer(&ax25->t3timer, ax25_t3timer_expiry, (unsigned long)ax25); 48 - setup_timer(&ax25->idletimer, ax25_idletimer_expiry, 49 - (unsigned long)ax25); 44 + timer_setup(&ax25->timer, ax25_heartbeat_expiry, 0); 45 + timer_setup(&ax25->t1timer, ax25_t1timer_expiry, 0); 46 + timer_setup(&ax25->t2timer, ax25_t2timer_expiry, 0); 47 + timer_setup(&ax25->t3timer, ax25_t3timer_expiry, 0); 48 + timer_setup(&ax25->idletimer, ax25_idletimer_expiry, 0); 50 49 } 51 50 52 51 void ax25_start_heartbeat(ax25_cb *ax25) ··· 119 120 120 121 EXPORT_SYMBOL(ax25_display_timer); 121 122 122 - static void ax25_heartbeat_expiry(unsigned long param) 123 + static void ax25_heartbeat_expiry(struct timer_list *t) 123 124 { 124 125 int proto = AX25_PROTO_STD_SIMPLEX; 125 - ax25_cb *ax25 = (ax25_cb *)param; 126 + ax25_cb *ax25 = from_timer(ax25, t, timer); 126 127 127 128 if (ax25->ax25_dev) 128 129 proto = ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]; ··· 144 145 } 145 146 } 146 147 147 - static void ax25_t1timer_expiry(unsigned long param) 148 + static void ax25_t1timer_expiry(struct timer_list *t) 148 149 { 149 - ax25_cb *ax25 = (ax25_cb *)param; 150 + ax25_cb *ax25 = from_timer(ax25, t, t1timer); 150 151 151 152 switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { 152 153 case AX25_PROTO_STD_SIMPLEX: ··· 163 164 } 164 165 } 165 166 166 - static void ax25_t2timer_expiry(unsigned long param) 167 + static void ax25_t2timer_expiry(struct timer_list *t) 167 168 { 168 - ax25_cb *ax25 = (ax25_cb *)param; 169 + ax25_cb *ax25 = from_timer(ax25, t, t2timer); 169 170 170 171 switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { 171 172 case AX25_PROTO_STD_SIMPLEX: ··· 182 183 } 183 184 } 184 185 185 - static void ax25_t3timer_expiry(unsigned long param) 186 + static void ax25_t3timer_expiry(struct timer_list *t) 186 187 { 187 - ax25_cb *ax25 = (ax25_cb *)param; 188 + ax25_cb *ax25 = from_timer(ax25, t, t3timer); 188 189 189 190 switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { 190 191 case AX25_PROTO_STD_SIMPLEX: ··· 203 204 } 204 205 } 205 206 206 - static void ax25_idletimer_expiry(unsigned long param) 207 + static void ax25_idletimer_expiry(struct timer_list *t) 207 208 { 208 - ax25_cb *ax25 = (ax25_cb *)param; 209 + ax25_cb *ax25 = from_timer(ax25, t, idletimer); 209 210 210 211 switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { 211 212 case AX25_PROTO_STD_SIMPLEX: