Commit e313ac12 authored by Kees Cook's avatar Kees Cook Committed by David S. Miller

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: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d9935679
...@@ -172,7 +172,6 @@ isac_fill_fifo(struct isac_hw *isac) ...@@ -172,7 +172,6 @@ isac_fill_fifo(struct isac_hw *isac)
pr_debug("%s: %s dbusytimer running\n", isac->name, __func__); pr_debug("%s: %s dbusytimer running\n", isac->name, __func__);
del_timer(&isac->dch.timer); del_timer(&isac->dch.timer);
} }
init_timer(&isac->dch.timer);
isac->dch.timer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ)/1000); isac->dch.timer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ)/1000);
add_timer(&isac->dch.timer); add_timer(&isac->dch.timer);
if (isac->dch.debug & DEBUG_HW_DFIFO) { if (isac->dch.debug & DEBUG_HW_DFIFO) {
...@@ -727,8 +726,9 @@ isac_release(struct isac_hw *isac) ...@@ -727,8 +726,9 @@ isac_release(struct isac_hw *isac)
} }
static void static void
dbusy_timer_handler(struct isac_hw *isac) dbusy_timer_handler(struct timer_list *t)
{ {
struct isac_hw *isac = from_timer(isac, t, dch.timer);
int rbch, star; int rbch, star;
u_long flags; u_long flags;
...@@ -796,8 +796,7 @@ isac_init(struct isac_hw *isac) ...@@ -796,8 +796,7 @@ isac_init(struct isac_hw *isac)
} }
isac->mon_tx = NULL; isac->mon_tx = NULL;
isac->mon_rx = NULL; isac->mon_rx = NULL;
setup_timer(&isac->dch.timer, (void *)dbusy_timer_handler, timer_setup(&isac->dch.timer, dbusy_timer_handler, 0);
(long)isac);
isac->mocr = 0xaa; isac->mocr = 0xaa;
if (isac->type & IPAC_TYPE_ISACX) { if (isac->type & IPAC_TYPE_ISACX) {
/* Disable all IRQ */ /* Disable all IRQ */
......
...@@ -311,7 +311,6 @@ W6692_fill_Dfifo(struct w6692_hw *card) ...@@ -311,7 +311,6 @@ W6692_fill_Dfifo(struct w6692_hw *card)
pr_debug("%s: fill_Dfifo dbusytimer running\n", card->name); pr_debug("%s: fill_Dfifo dbusytimer running\n", card->name);
del_timer(&dch->timer); del_timer(&dch->timer);
} }
init_timer(&dch->timer);
dch->timer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ) / 1000); dch->timer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ) / 1000);
add_timer(&dch->timer); add_timer(&dch->timer);
if (debug & DEBUG_HW_DFIFO) { if (debug & DEBUG_HW_DFIFO) {
...@@ -819,8 +818,9 @@ w6692_irq(int intno, void *dev_id) ...@@ -819,8 +818,9 @@ w6692_irq(int intno, void *dev_id)
} }
static void static void
dbusy_timer_handler(struct dchannel *dch) dbusy_timer_handler(struct timer_list *t)
{ {
struct dchannel *dch = from_timer(dch, t, timer);
struct w6692_hw *card = dch->hw; struct w6692_hw *card = dch->hw;
int rbch, star; int rbch, star;
u_long flags; u_long flags;
...@@ -852,8 +852,7 @@ static void initW6692(struct w6692_hw *card) ...@@ -852,8 +852,7 @@ static void initW6692(struct w6692_hw *card)
{ {
u8 val; u8 val;
setup_timer(&card->dch.timer, (void *)dbusy_timer_handler, timer_setup(&card->dch.timer, dbusy_timer_handler, 0);
(u_long)&card->dch);
w6692_mode(&card->bc[0], ISDN_P_NONE); w6692_mode(&card->bc[0], ISDN_P_NONE);
w6692_mode(&card->bc[1], ISDN_P_NONE); w6692_mode(&card->bc[1], ISDN_P_NONE);
WriteW6692(card, W_D_CTL, 0x00); WriteW6692(card, W_D_CTL, 0x00);
......
...@@ -259,7 +259,7 @@ extern u8 *dsp_dtmf_goertzel_decode(struct dsp *dsp, u8 *data, int len, ...@@ -259,7 +259,7 @@ extern u8 *dsp_dtmf_goertzel_decode(struct dsp *dsp, u8 *data, int len,
extern int dsp_tone(struct dsp *dsp, int tone); extern int dsp_tone(struct dsp *dsp, int tone);
extern void dsp_tone_copy(struct dsp *dsp, u8 *data, int len); extern void dsp_tone_copy(struct dsp *dsp, u8 *data, int len);
extern void dsp_tone_timeout(void *arg); extern void dsp_tone_timeout(struct timer_list *t);
extern void dsp_bf_encrypt(struct dsp *dsp, u8 *data, int len); extern void dsp_bf_encrypt(struct dsp *dsp, u8 *data, int len);
extern void dsp_bf_decrypt(struct dsp *dsp, u8 *data, int len); extern void dsp_bf_decrypt(struct dsp *dsp, u8 *data, int len);
......
...@@ -1092,7 +1092,7 @@ dspcreate(struct channel_req *crq) ...@@ -1092,7 +1092,7 @@ dspcreate(struct channel_req *crq)
ndsp->pcm_bank_tx = -1; ndsp->pcm_bank_tx = -1;
ndsp->hfc_conf = -1; /* current conference number */ ndsp->hfc_conf = -1; /* current conference number */
/* set tone timer */ /* set tone timer */
setup_timer(&ndsp->tone.tl, (void *)dsp_tone_timeout, (long)ndsp); timer_setup(&ndsp->tone.tl, dsp_tone_timeout, 0);
if (dtmfthreshold < 20 || dtmfthreshold > 500) if (dtmfthreshold < 20 || dtmfthreshold > 500)
dtmfthreshold = 200; dtmfthreshold = 200;
...@@ -1202,9 +1202,7 @@ static int __init dsp_init(void) ...@@ -1202,9 +1202,7 @@ static int __init dsp_init(void)
} }
/* set sample timer */ /* set sample timer */
dsp_spl_tl.function = (void *)dsp_cmx_send; timer_setup(&dsp_spl_tl, (void *)dsp_cmx_send, 0);
dsp_spl_tl.data = 0;
init_timer(&dsp_spl_tl);
dsp_spl_tl.expires = jiffies + dsp_tics; dsp_spl_tl.expires = jiffies + dsp_tics;
dsp_spl_jiffies = dsp_spl_tl.expires; dsp_spl_jiffies = dsp_spl_tl.expires;
add_timer(&dsp_spl_tl); add_timer(&dsp_spl_tl);
......
...@@ -457,9 +457,9 @@ dsp_tone_hw_message(struct dsp *dsp, u8 *sample, int len) ...@@ -457,9 +457,9 @@ dsp_tone_hw_message(struct dsp *dsp, u8 *sample, int len)
* timer expires * * timer expires *
*****************/ *****************/
void void
dsp_tone_timeout(void *arg) dsp_tone_timeout(struct timer_list *t)
{ {
struct dsp *dsp = arg; struct dsp *dsp = from_timer(dsp, t, tone.tl);
struct dsp_tone *tone = &dsp->tone; struct dsp_tone *tone = &dsp->tone;
struct pattern *pat = (struct pattern *)tone->pattern; struct pattern *pat = (struct pattern *)tone->pattern;
int index = tone->index; int index = tone->index;
...@@ -478,7 +478,6 @@ dsp_tone_timeout(void *arg) ...@@ -478,7 +478,6 @@ dsp_tone_timeout(void *arg)
else else
dsp_tone_hw_message(dsp, pat->data[index], *(pat->siz[index])); dsp_tone_hw_message(dsp, pat->data[index], *(pat->siz[index]));
/* set timer */ /* set timer */
init_timer(&tone->tl);
tone->tl.expires = jiffies + (pat->seq[index] * HZ) / 8000; tone->tl.expires = jiffies + (pat->seq[index] * HZ) / 8000;
add_timer(&tone->tl); add_timer(&tone->tl);
} }
...@@ -541,7 +540,6 @@ dsp_tone(struct dsp *dsp, int tone) ...@@ -541,7 +540,6 @@ dsp_tone(struct dsp *dsp, int tone)
/* set timer */ /* set timer */
if (timer_pending(&tonet->tl)) if (timer_pending(&tonet->tl))
del_timer(&tonet->tl); del_timer(&tonet->tl);
init_timer(&tonet->tl);
tonet->tl.expires = jiffies + (pat->seq[0] * HZ) / 8000; tonet->tl.expires = jiffies + (pat->seq[0] * HZ) / 8000;
add_timer(&tonet->tl); add_timer(&tonet->tl);
} else { } else {
......
...@@ -100,8 +100,9 @@ mISDN_FsmChangeState(struct FsmInst *fi, int newstate) ...@@ -100,8 +100,9 @@ mISDN_FsmChangeState(struct FsmInst *fi, int newstate)
EXPORT_SYMBOL(mISDN_FsmChangeState); EXPORT_SYMBOL(mISDN_FsmChangeState);
static void static void
FsmExpireTimer(struct FsmTimer *ft) FsmExpireTimer(struct timer_list *t)
{ {
struct FsmTimer *ft = from_timer(ft, t, tl);
#if FSM_TIMER_DEBUG #if FSM_TIMER_DEBUG
if (ft->fi->debug) if (ft->fi->debug)
ft->fi->printdebug(ft->fi, "FsmExpireTimer %lx", (long) ft); ft->fi->printdebug(ft->fi, "FsmExpireTimer %lx", (long) ft);
...@@ -117,7 +118,7 @@ mISDN_FsmInitTimer(struct FsmInst *fi, struct FsmTimer *ft) ...@@ -117,7 +118,7 @@ mISDN_FsmInitTimer(struct FsmInst *fi, struct FsmTimer *ft)
if (ft->fi->debug) if (ft->fi->debug)
ft->fi->printdebug(ft->fi, "mISDN_FsmInitTimer %lx", (long) ft); ft->fi->printdebug(ft->fi, "mISDN_FsmInitTimer %lx", (long) ft);
#endif #endif
setup_timer(&ft->tl, (void *)FsmExpireTimer, (long)ft); timer_setup(&ft->tl, FsmExpireTimer, 0);
} }
EXPORT_SYMBOL(mISDN_FsmInitTimer); EXPORT_SYMBOL(mISDN_FsmInitTimer);
...@@ -153,7 +154,6 @@ mISDN_FsmAddTimer(struct FsmTimer *ft, ...@@ -153,7 +154,6 @@ mISDN_FsmAddTimer(struct FsmTimer *ft,
} }
return -1; return -1;
} }
init_timer(&ft->tl);
ft->event = event; ft->event = event;
ft->arg = arg; ft->arg = arg;
ft->tl.expires = jiffies + (millisec * HZ) / 1000; ft->tl.expires = jiffies + (millisec * HZ) / 1000;
...@@ -175,7 +175,6 @@ mISDN_FsmRestartTimer(struct FsmTimer *ft, ...@@ -175,7 +175,6 @@ mISDN_FsmRestartTimer(struct FsmTimer *ft,
if (timer_pending(&ft->tl)) if (timer_pending(&ft->tl))
del_timer(&ft->tl); del_timer(&ft->tl);
init_timer(&ft->tl);
ft->event = event; ft->event = event;
ft->arg = arg; ft->arg = arg;
ft->tl.expires = jiffies + (millisec * HZ) / 1000; ft->tl.expires = jiffies + (millisec * HZ) / 1000;
......
...@@ -842,17 +842,18 @@ l1oip_send_bh(struct work_struct *work) ...@@ -842,17 +842,18 @@ l1oip_send_bh(struct work_struct *work)
* timer stuff * timer stuff
*/ */
static void static void
l1oip_keepalive(void *data) l1oip_keepalive(struct timer_list *t)
{ {
struct l1oip *hc = (struct l1oip *)data; struct l1oip *hc = from_timer(hc, t, keep_tl);
schedule_work(&hc->workq); schedule_work(&hc->workq);
} }
static void static void
l1oip_timeout(void *data) l1oip_timeout(struct timer_list *t)
{ {
struct l1oip *hc = (struct l1oip *)data; struct l1oip *hc = from_timer(hc, t,
timeout_tl);
struct dchannel *dch = hc->chan[hc->d_idx].dch; struct dchannel *dch = hc->chan[hc->d_idx].dch;
if (debug & DEBUG_L1OIP_MSG) if (debug & DEBUG_L1OIP_MSG)
...@@ -1437,13 +1438,11 @@ init_card(struct l1oip *hc, int pri, int bundle) ...@@ -1437,13 +1438,11 @@ init_card(struct l1oip *hc, int pri, int bundle)
if (ret) if (ret)
return ret; return ret;
hc->keep_tl.function = (void *)l1oip_keepalive; timer_setup(&hc->keep_tl, l1oip_keepalive, 0);
hc->keep_tl.data = (ulong)hc;
init_timer(&hc->keep_tl);
hc->keep_tl.expires = jiffies + 2 * HZ; /* two seconds first time */ hc->keep_tl.expires = jiffies + 2 * HZ; /* two seconds first time */
add_timer(&hc->keep_tl); add_timer(&hc->keep_tl);
setup_timer(&hc->timeout_tl, (void *)l1oip_timeout, (ulong)hc); timer_setup(&hc->timeout_tl, l1oip_timeout, 0);
hc->timeout_on = 0; /* state that we have timer off */ hc->timeout_on = 0; /* state that we have timer off */
return 0; return 0;
......
...@@ -162,9 +162,9 @@ mISDN_poll(struct file *filep, poll_table *wait) ...@@ -162,9 +162,9 @@ mISDN_poll(struct file *filep, poll_table *wait)
} }
static void static void
dev_expire_timer(unsigned long data) dev_expire_timer(struct timer_list *t)
{ {
struct mISDNtimer *timer = (void *)data; struct mISDNtimer *timer = from_timer(timer, t, tl);
u_long flags; u_long flags;
spin_lock_irqsave(&timer->dev->lock, flags); spin_lock_irqsave(&timer->dev->lock, flags);
...@@ -189,7 +189,7 @@ misdn_add_timer(struct mISDNtimerdev *dev, int timeout) ...@@ -189,7 +189,7 @@ misdn_add_timer(struct mISDNtimerdev *dev, int timeout)
if (!timer) if (!timer)
return -ENOMEM; return -ENOMEM;
timer->dev = dev; timer->dev = dev;
setup_timer(&timer->tl, dev_expire_timer, (long)timer); timer_setup(&timer->tl, dev_expire_timer, 0);
spin_lock_irq(&dev->lock); spin_lock_irq(&dev->lock);
id = timer->id = dev->next_id++; id = timer->id = dev->next_id++;
if (dev->next_id < 0) if (dev->next_id < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment