Skip to content

Commit 1128612

Browse files
keesdavem330
authored andcommitted
isdnloop: 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. Added missing initialization for rb_timer. Cc: Karsten Keil <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Al Viro <[email protected]> Cc: Stephen Hemminger <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Johannes Berg <[email protected]> Cc: [email protected] Signed-off-by: Kees Cook <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5f2585d commit 1128612

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

drivers/isdn/isdnloop/isdnloop.c

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ isdnloop_bchan_send(isdnloop_card *card, int ch)
9090
* data = pointer to card struct, set by kernel timer.data
9191
*/
9292
static void
93-
isdnloop_pollbchan(unsigned long data)
93+
isdnloop_pollbchan(struct timer_list *t)
9494
{
95-
isdnloop_card *card = (isdnloop_card *) data;
95+
isdnloop_card *card = from_timer(card, t, rb_timer);
9696
unsigned long flags;
9797

9898
if (card->flags & ISDNLOOP_FLAGS_B1ACTIVE)
@@ -305,9 +305,9 @@ isdnloop_putmsg(isdnloop_card *card, unsigned char c)
305305
* data = pointer to card struct
306306
*/
307307
static void
308-
isdnloop_polldchan(unsigned long data)
308+
isdnloop_polldchan(struct timer_list *t)
309309
{
310-
isdnloop_card *card = (isdnloop_card *) data;
310+
isdnloop_card *card = from_timer(card, t, st_timer);
311311
struct sk_buff *skb;
312312
int avail;
313313
int left;
@@ -373,8 +373,6 @@ isdnloop_polldchan(unsigned long data)
373373
card->flags |= ISDNLOOP_FLAGS_RBTIMER;
374374
spin_lock_irqsave(&card->isdnloop_lock, flags);
375375
del_timer(&card->rb_timer);
376-
card->rb_timer.function = isdnloop_pollbchan;
377-
card->rb_timer.data = (unsigned long) card;
378376
card->rb_timer.expires = jiffies + ISDNLOOP_TIMER_BCREAD;
379377
add_timer(&card->rb_timer);
380378
spin_unlock_irqrestore(&card->isdnloop_lock, flags);
@@ -588,19 +586,21 @@ isdnloop_atimeout(isdnloop_card *card, int ch)
588586
* Wrapper for isdnloop_atimeout().
589587
*/
590588
static void
591-
isdnloop_atimeout0(unsigned long data)
589+
isdnloop_atimeout0(struct timer_list *t)
592590
{
593-
isdnloop_card *card = (isdnloop_card *) data;
591+
isdnloop_card *card = from_timer(card, t, c_timer[0]);
592+
594593
isdnloop_atimeout(card, 0);
595594
}
596595

597596
/*
598597
* Wrapper for isdnloop_atimeout().
599598
*/
600599
static void
601-
isdnloop_atimeout1(unsigned long data)
600+
isdnloop_atimeout1(struct timer_list *t)
602601
{
603-
isdnloop_card *card = (isdnloop_card *) data;
602+
isdnloop_card *card = from_timer(card, t, c_timer[1]);
603+
604604
isdnloop_atimeout(card, 1);
605605
}
606606

@@ -617,13 +617,9 @@ isdnloop_start_ctimer(isdnloop_card *card, int ch)
617617
unsigned long flags;
618618

619619
spin_lock_irqsave(&card->isdnloop_lock, flags);
620-
init_timer(&card->c_timer[ch]);
620+
timer_setup(&card->c_timer[ch], ch ? isdnloop_atimeout1
621+
: isdnloop_atimeout0, 0);
621622
card->c_timer[ch].expires = jiffies + ISDNLOOP_TIMER_ALERTWAIT;
622-
if (ch)
623-
card->c_timer[ch].function = isdnloop_atimeout1;
624-
else
625-
card->c_timer[ch].function = isdnloop_atimeout0;
626-
card->c_timer[ch].data = (unsigned long) card;
627623
add_timer(&card->c_timer[ch]);
628624
spin_unlock_irqrestore(&card->isdnloop_lock, flags);
629625
}
@@ -1113,10 +1109,9 @@ isdnloop_start(isdnloop_card *card, isdnloop_sdef *sdefp)
11131109
sdef.ptype);
11141110
return -EINVAL;
11151111
}
1116-
init_timer(&card->st_timer);
1112+
timer_setup(&card->rb_timer, isdnloop_pollbchan, 0);
1113+
timer_setup(&card->st_timer, isdnloop_polldchan, 0);
11171114
card->st_timer.expires = jiffies + ISDNLOOP_TIMER_DCREAD;
1118-
card->st_timer.function = isdnloop_polldchan;
1119-
card->st_timer.data = (unsigned long) card;
11201115
add_timer(&card->st_timer);
11211116
card->flags |= ISDNLOOP_FLAGS_RUNNING;
11221117
spin_unlock_irqrestore(&card->isdnloop_lock, flags);

0 commit comments

Comments
 (0)