Skip to content

Commit 83a37b3

Browse files
keesdavem330
authored andcommitted
net/lapb: 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" <[email protected]> Cc: Hans Liljestrand <[email protected]> Cc: "Reshetova, Elena" <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Kees Cook <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent eb4ddaf commit 83a37b3

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

net/lapb/lapb_iface.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ static struct lapb_cb *lapb_create_cb(void)
127127
skb_queue_head_init(&lapb->write_queue);
128128
skb_queue_head_init(&lapb->ack_queue);
129129

130-
init_timer(&lapb->t1timer);
131-
init_timer(&lapb->t2timer);
130+
timer_setup(&lapb->t1timer, NULL, 0);
131+
timer_setup(&lapb->t2timer, NULL, 0);
132132

133133
lapb->t1 = LAPB_DEFAULT_T1;
134134
lapb->t2 = LAPB_DEFAULT_T2;

net/lapb/lapb_timer.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,14 @@
3535
#include <linux/interrupt.h>
3636
#include <net/lapb.h>
3737

38-
static void lapb_t1timer_expiry(unsigned long);
39-
static void lapb_t2timer_expiry(unsigned long);
38+
static void lapb_t1timer_expiry(struct timer_list *);
39+
static void lapb_t2timer_expiry(struct timer_list *);
4040

4141
void lapb_start_t1timer(struct lapb_cb *lapb)
4242
{
4343
del_timer(&lapb->t1timer);
4444

45-
lapb->t1timer.data = (unsigned long)lapb;
46-
lapb->t1timer.function = &lapb_t1timer_expiry;
45+
lapb->t1timer.function = (TIMER_FUNC_TYPE)lapb_t1timer_expiry;
4746
lapb->t1timer.expires = jiffies + lapb->t1;
4847

4948
add_timer(&lapb->t1timer);
@@ -53,8 +52,7 @@ void lapb_start_t2timer(struct lapb_cb *lapb)
5352
{
5453
del_timer(&lapb->t2timer);
5554

56-
lapb->t2timer.data = (unsigned long)lapb;
57-
lapb->t2timer.function = &lapb_t2timer_expiry;
55+
lapb->t2timer.function = (TIMER_FUNC_TYPE)lapb_t2timer_expiry;
5856
lapb->t2timer.expires = jiffies + lapb->t2;
5957

6058
add_timer(&lapb->t2timer);
@@ -75,19 +73,19 @@ int lapb_t1timer_running(struct lapb_cb *lapb)
7573
return timer_pending(&lapb->t1timer);
7674
}
7775

78-
static void lapb_t2timer_expiry(unsigned long param)
76+
static void lapb_t2timer_expiry(struct timer_list *t)
7977
{
80-
struct lapb_cb *lapb = (struct lapb_cb *)param;
78+
struct lapb_cb *lapb = from_timer(lapb, t, t2timer);
8179

8280
if (lapb->condition & LAPB_ACK_PENDING_CONDITION) {
8381
lapb->condition &= ~LAPB_ACK_PENDING_CONDITION;
8482
lapb_timeout_response(lapb);
8583
}
8684
}
8785

88-
static void lapb_t1timer_expiry(unsigned long param)
86+
static void lapb_t1timer_expiry(struct timer_list *t)
8987
{
90-
struct lapb_cb *lapb = (struct lapb_cb *)param;
88+
struct lapb_cb *lapb = from_timer(lapb, t, t1timer);
9189

9290
switch (lapb->state) {
9391

0 commit comments

Comments
 (0)