Skip to content

Commit e313ac1

Browse files
keesdavem330
authored andcommitted
mISDN: 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: Karsten Keil <isdn@linux-pingi.de> Cc: Geliang Tang <geliangtang@gmail.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Anton Vasilyev <vasilyev@ispras.ru> Cc: Ingo Molnar <mingo@kernel.org> Cc: netdev@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent d993567 commit e313ac1

File tree

8 files changed

+24
-32
lines changed

8 files changed

+24
-32
lines changed

drivers/isdn/hardware/mISDN/mISDNipac.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ isac_fill_fifo(struct isac_hw *isac)
172172
pr_debug("%s: %s dbusytimer running\n", isac->name, __func__);
173173
del_timer(&isac->dch.timer);
174174
}
175-
init_timer(&isac->dch.timer);
176175
isac->dch.timer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ)/1000);
177176
add_timer(&isac->dch.timer);
178177
if (isac->dch.debug & DEBUG_HW_DFIFO) {
@@ -727,8 +726,9 @@ isac_release(struct isac_hw *isac)
727726
}
728727

729728
static void
730-
dbusy_timer_handler(struct isac_hw *isac)
729+
dbusy_timer_handler(struct timer_list *t)
731730
{
731+
struct isac_hw *isac = from_timer(isac, t, dch.timer);
732732
int rbch, star;
733733
u_long flags;
734734

@@ -796,8 +796,7 @@ isac_init(struct isac_hw *isac)
796796
}
797797
isac->mon_tx = NULL;
798798
isac->mon_rx = NULL;
799-
setup_timer(&isac->dch.timer, (void *)dbusy_timer_handler,
800-
(long)isac);
799+
timer_setup(&isac->dch.timer, dbusy_timer_handler, 0);
801800
isac->mocr = 0xaa;
802801
if (isac->type & IPAC_TYPE_ISACX) {
803802
/* Disable all IRQ */

drivers/isdn/hardware/mISDN/w6692.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,6 @@ W6692_fill_Dfifo(struct w6692_hw *card)
311311
pr_debug("%s: fill_Dfifo dbusytimer running\n", card->name);
312312
del_timer(&dch->timer);
313313
}
314-
init_timer(&dch->timer);
315314
dch->timer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ) / 1000);
316315
add_timer(&dch->timer);
317316
if (debug & DEBUG_HW_DFIFO) {
@@ -819,8 +818,9 @@ w6692_irq(int intno, void *dev_id)
819818
}
820819

821820
static void
822-
dbusy_timer_handler(struct dchannel *dch)
821+
dbusy_timer_handler(struct timer_list *t)
823822
{
823+
struct dchannel *dch = from_timer(dch, t, timer);
824824
struct w6692_hw *card = dch->hw;
825825
int rbch, star;
826826
u_long flags;
@@ -852,8 +852,7 @@ static void initW6692(struct w6692_hw *card)
852852
{
853853
u8 val;
854854

855-
setup_timer(&card->dch.timer, (void *)dbusy_timer_handler,
856-
(u_long)&card->dch);
855+
timer_setup(&card->dch.timer, dbusy_timer_handler, 0);
857856
w6692_mode(&card->bc[0], ISDN_P_NONE);
858857
w6692_mode(&card->bc[1], ISDN_P_NONE);
859858
WriteW6692(card, W_D_CTL, 0x00);

drivers/isdn/mISDN/dsp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ extern u8 *dsp_dtmf_goertzel_decode(struct dsp *dsp, u8 *data, int len,
259259

260260
extern int dsp_tone(struct dsp *dsp, int tone);
261261
extern void dsp_tone_copy(struct dsp *dsp, u8 *data, int len);
262-
extern void dsp_tone_timeout(void *arg);
262+
extern void dsp_tone_timeout(struct timer_list *t);
263263

264264
extern void dsp_bf_encrypt(struct dsp *dsp, u8 *data, int len);
265265
extern void dsp_bf_decrypt(struct dsp *dsp, u8 *data, int len);

drivers/isdn/mISDN/dsp_core.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,7 @@ dspcreate(struct channel_req *crq)
10921092
ndsp->pcm_bank_tx = -1;
10931093
ndsp->hfc_conf = -1; /* current conference number */
10941094
/* set tone timer */
1095-
setup_timer(&ndsp->tone.tl, (void *)dsp_tone_timeout, (long)ndsp);
1095+
timer_setup(&ndsp->tone.tl, dsp_tone_timeout, 0);
10961096

10971097
if (dtmfthreshold < 20 || dtmfthreshold > 500)
10981098
dtmfthreshold = 200;
@@ -1202,9 +1202,7 @@ static int __init dsp_init(void)
12021202
}
12031203

12041204
/* set sample timer */
1205-
dsp_spl_tl.function = (void *)dsp_cmx_send;
1206-
dsp_spl_tl.data = 0;
1207-
init_timer(&dsp_spl_tl);
1205+
timer_setup(&dsp_spl_tl, (void *)dsp_cmx_send, 0);
12081206
dsp_spl_tl.expires = jiffies + dsp_tics;
12091207
dsp_spl_jiffies = dsp_spl_tl.expires;
12101208
add_timer(&dsp_spl_tl);

drivers/isdn/mISDN/dsp_tones.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -457,9 +457,9 @@ dsp_tone_hw_message(struct dsp *dsp, u8 *sample, int len)
457457
* timer expires *
458458
*****************/
459459
void
460-
dsp_tone_timeout(void *arg)
460+
dsp_tone_timeout(struct timer_list *t)
461461
{
462-
struct dsp *dsp = arg;
462+
struct dsp *dsp = from_timer(dsp, t, tone.tl);
463463
struct dsp_tone *tone = &dsp->tone;
464464
struct pattern *pat = (struct pattern *)tone->pattern;
465465
int index = tone->index;
@@ -478,7 +478,6 @@ dsp_tone_timeout(void *arg)
478478
else
479479
dsp_tone_hw_message(dsp, pat->data[index], *(pat->siz[index]));
480480
/* set timer */
481-
init_timer(&tone->tl);
482481
tone->tl.expires = jiffies + (pat->seq[index] * HZ) / 8000;
483482
add_timer(&tone->tl);
484483
}
@@ -541,7 +540,6 @@ dsp_tone(struct dsp *dsp, int tone)
541540
/* set timer */
542541
if (timer_pending(&tonet->tl))
543542
del_timer(&tonet->tl);
544-
init_timer(&tonet->tl);
545543
tonet->tl.expires = jiffies + (pat->seq[0] * HZ) / 8000;
546544
add_timer(&tonet->tl);
547545
} else {

drivers/isdn/mISDN/fsm.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,9 @@ mISDN_FsmChangeState(struct FsmInst *fi, int newstate)
100100
EXPORT_SYMBOL(mISDN_FsmChangeState);
101101

102102
static void
103-
FsmExpireTimer(struct FsmTimer *ft)
103+
FsmExpireTimer(struct timer_list *t)
104104
{
105+
struct FsmTimer *ft = from_timer(ft, t, tl);
105106
#if FSM_TIMER_DEBUG
106107
if (ft->fi->debug)
107108
ft->fi->printdebug(ft->fi, "FsmExpireTimer %lx", (long) ft);
@@ -117,7 +118,7 @@ mISDN_FsmInitTimer(struct FsmInst *fi, struct FsmTimer *ft)
117118
if (ft->fi->debug)
118119
ft->fi->printdebug(ft->fi, "mISDN_FsmInitTimer %lx", (long) ft);
119120
#endif
120-
setup_timer(&ft->tl, (void *)FsmExpireTimer, (long)ft);
121+
timer_setup(&ft->tl, FsmExpireTimer, 0);
121122
}
122123
EXPORT_SYMBOL(mISDN_FsmInitTimer);
123124

@@ -153,7 +154,6 @@ mISDN_FsmAddTimer(struct FsmTimer *ft,
153154
}
154155
return -1;
155156
}
156-
init_timer(&ft->tl);
157157
ft->event = event;
158158
ft->arg = arg;
159159
ft->tl.expires = jiffies + (millisec * HZ) / 1000;
@@ -175,7 +175,6 @@ mISDN_FsmRestartTimer(struct FsmTimer *ft,
175175

176176
if (timer_pending(&ft->tl))
177177
del_timer(&ft->tl);
178-
init_timer(&ft->tl);
179178
ft->event = event;
180179
ft->arg = arg;
181180
ft->tl.expires = jiffies + (millisec * HZ) / 1000;

drivers/isdn/mISDN/l1oip_core.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -842,17 +842,18 @@ l1oip_send_bh(struct work_struct *work)
842842
* timer stuff
843843
*/
844844
static void
845-
l1oip_keepalive(void *data)
845+
l1oip_keepalive(struct timer_list *t)
846846
{
847-
struct l1oip *hc = (struct l1oip *)data;
847+
struct l1oip *hc = from_timer(hc, t, keep_tl);
848848

849849
schedule_work(&hc->workq);
850850
}
851851

852852
static void
853-
l1oip_timeout(void *data)
853+
l1oip_timeout(struct timer_list *t)
854854
{
855-
struct l1oip *hc = (struct l1oip *)data;
855+
struct l1oip *hc = from_timer(hc, t,
856+
timeout_tl);
856857
struct dchannel *dch = hc->chan[hc->d_idx].dch;
857858

858859
if (debug & DEBUG_L1OIP_MSG)
@@ -1437,13 +1438,11 @@ init_card(struct l1oip *hc, int pri, int bundle)
14371438
if (ret)
14381439
return ret;
14391440

1440-
hc->keep_tl.function = (void *)l1oip_keepalive;
1441-
hc->keep_tl.data = (ulong)hc;
1442-
init_timer(&hc->keep_tl);
1441+
timer_setup(&hc->keep_tl, l1oip_keepalive, 0);
14431442
hc->keep_tl.expires = jiffies + 2 * HZ; /* two seconds first time */
14441443
add_timer(&hc->keep_tl);
14451444

1446-
setup_timer(&hc->timeout_tl, (void *)l1oip_timeout, (ulong)hc);
1445+
timer_setup(&hc->timeout_tl, l1oip_timeout, 0);
14471446
hc->timeout_on = 0; /* state that we have timer off */
14481447

14491448
return 0;

drivers/isdn/mISDN/timerdev.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ mISDN_poll(struct file *filep, poll_table *wait)
162162
}
163163

164164
static void
165-
dev_expire_timer(unsigned long data)
165+
dev_expire_timer(struct timer_list *t)
166166
{
167-
struct mISDNtimer *timer = (void *)data;
167+
struct mISDNtimer *timer = from_timer(timer, t, tl);
168168
u_long flags;
169169

170170
spin_lock_irqsave(&timer->dev->lock, flags);
@@ -189,7 +189,7 @@ misdn_add_timer(struct mISDNtimerdev *dev, int timeout)
189189
if (!timer)
190190
return -ENOMEM;
191191
timer->dev = dev;
192-
setup_timer(&timer->tl, dev_expire_timer, (long)timer);
192+
timer_setup(&timer->tl, dev_expire_timer, 0);
193193
spin_lock_irq(&dev->lock);
194194
id = timer->id = dev->next_id++;
195195
if (dev->next_id < 0)

0 commit comments

Comments
 (0)