Skip to content

Commit

Permalink
net/lapb: Convert timers to use timer_setup()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
kees authored and davem330 committed Oct 18, 2017
1 parent eb4ddaf commit 83a37b3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
4 changes: 2 additions & 2 deletions net/lapb/lapb_iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ static struct lapb_cb *lapb_create_cb(void)
skb_queue_head_init(&lapb->write_queue);
skb_queue_head_init(&lapb->ack_queue);

init_timer(&lapb->t1timer);
init_timer(&lapb->t2timer);
timer_setup(&lapb->t1timer, NULL, 0);
timer_setup(&lapb->t2timer, NULL, 0);

lapb->t1 = LAPB_DEFAULT_T1;
lapb->t2 = LAPB_DEFAULT_T2;
Expand Down
18 changes: 8 additions & 10 deletions net/lapb/lapb_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,14 @@
#include <linux/interrupt.h>
#include <net/lapb.h>

static void lapb_t1timer_expiry(unsigned long);
static void lapb_t2timer_expiry(unsigned long);
static void lapb_t1timer_expiry(struct timer_list *);
static void lapb_t2timer_expiry(struct timer_list *);

void lapb_start_t1timer(struct lapb_cb *lapb)
{
del_timer(&lapb->t1timer);

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

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

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

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

static void lapb_t2timer_expiry(unsigned long param)
static void lapb_t2timer_expiry(struct timer_list *t)
{
struct lapb_cb *lapb = (struct lapb_cb *)param;
struct lapb_cb *lapb = from_timer(lapb, t, t2timer);

if (lapb->condition & LAPB_ACK_PENDING_CONDITION) {
lapb->condition &= ~LAPB_ACK_PENDING_CONDITION;
lapb_timeout_response(lapb);
}
}

static void lapb_t1timer_expiry(unsigned long param)
static void lapb_t1timer_expiry(struct timer_list *t)
{
struct lapb_cb *lapb = (struct lapb_cb *)param;
struct lapb_cb *lapb = from_timer(lapb, t, t1timer);

switch (lapb->state) {

Expand Down

0 comments on commit 83a37b3

Please sign in to comment.