summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2017-10-16 20:29:14 -0400
committerDavid S. Miller <davem@davemloft.net>2017-10-18 07:39:39 -0400
commite313ac12eb13a9738116192848695da54c38b1ae (patch)
tree1e12d6bc246d4135105c94fd346d61943f7a6a25
parentd99356797a8f3abaa57e13c5d1f50e4392eca037 (diff)
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>
-rw-r--r--drivers/isdn/hardware/mISDN/mISDNipac.c7
-rw-r--r--drivers/isdn/hardware/mISDN/w6692.c7
-rw-r--r--drivers/isdn/mISDN/dsp.h2
-rw-r--r--drivers/isdn/mISDN/dsp_core.c6
-rw-r--r--drivers/isdn/mISDN/dsp_tones.c6
-rw-r--r--drivers/isdn/mISDN/fsm.c7
-rw-r--r--drivers/isdn/mISDN/l1oip_core.c15
-rw-r--r--drivers/isdn/mISDN/timerdev.c6
8 files changed, 24 insertions, 32 deletions
diff --git a/drivers/isdn/hardware/mISDN/mISDNipac.c b/drivers/isdn/hardware/mISDN/mISDNipac.c
index e240010b93fa..4d78f870435e 100644
--- a/drivers/isdn/hardware/mISDN/mISDNipac.c
+++ b/drivers/isdn/hardware/mISDN/mISDNipac.c
@@ -172,7 +172,6 @@ isac_fill_fifo(struct isac_hw *isac)
172 pr_debug("%s: %s dbusytimer running\n", isac->name, __func__); 172 pr_debug("%s: %s dbusytimer running\n", isac->name, __func__);
173 del_timer(&isac->dch.timer); 173 del_timer(&isac->dch.timer);
174 } 174 }
175 init_timer(&isac->dch.timer);
176 isac->dch.timer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ)/1000); 175 isac->dch.timer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ)/1000);
177 add_timer(&isac->dch.timer); 176 add_timer(&isac->dch.timer);
178 if (isac->dch.debug & DEBUG_HW_DFIFO) { 177 if (isac->dch.debug & DEBUG_HW_DFIFO) {
@@ -727,8 +726,9 @@ isac_release(struct isac_hw *isac)
727} 726}
728 727
729static void 728static void
730dbusy_timer_handler(struct isac_hw *isac) 729dbusy_timer_handler(struct timer_list *t)
731{ 730{
731 struct isac_hw *isac = from_timer(isac, t, dch.timer);
732 int rbch, star; 732 int rbch, star;
733 u_long flags; 733 u_long flags;
734 734
@@ -796,8 +796,7 @@ isac_init(struct isac_hw *isac)
796 } 796 }
797 isac->mon_tx = NULL; 797 isac->mon_tx = NULL;
798 isac->mon_rx = NULL; 798 isac->mon_rx = NULL;
799 setup_timer(&isac->dch.timer, (void *)dbusy_timer_handler, 799 timer_setup(&isac->dch.timer, dbusy_timer_handler, 0);
800 (long)isac);
801 isac->mocr = 0xaa; 800 isac->mocr = 0xaa;
802 if (isac->type & IPAC_TYPE_ISACX) { 801 if (isac->type & IPAC_TYPE_ISACX) {
803 /* Disable all IRQ */ 802 /* Disable all IRQ */
diff --git a/drivers/isdn/hardware/mISDN/w6692.c b/drivers/isdn/hardware/mISDN/w6692.c
index d80072fef434..536d5137f49d 100644
--- a/drivers/isdn/hardware/mISDN/w6692.c
+++ b/drivers/isdn/hardware/mISDN/w6692.c
@@ -311,7 +311,6 @@ W6692_fill_Dfifo(struct w6692_hw *card)
311 pr_debug("%s: fill_Dfifo dbusytimer running\n", card->name); 311 pr_debug("%s: fill_Dfifo dbusytimer running\n", card->name);
312 del_timer(&dch->timer); 312 del_timer(&dch->timer);
313 } 313 }
314 init_timer(&dch->timer);
315 dch->timer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ) / 1000); 314 dch->timer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ) / 1000);
316 add_timer(&dch->timer); 315 add_timer(&dch->timer);
317 if (debug & DEBUG_HW_DFIFO) { 316 if (debug & DEBUG_HW_DFIFO) {
@@ -819,8 +818,9 @@ w6692_irq(int intno, void *dev_id)
819} 818}
820 819
821static void 820static void
822dbusy_timer_handler(struct dchannel *dch) 821dbusy_timer_handler(struct timer_list *t)
823{ 822{
823 struct dchannel *dch = from_timer(dch, t, timer);
824 struct w6692_hw *card = dch->hw; 824 struct w6692_hw *card = dch->hw;
825 int rbch, star; 825 int rbch, star;
826 u_long flags; 826 u_long flags;
@@ -852,8 +852,7 @@ static void initW6692(struct w6692_hw *card)
852{ 852{
853 u8 val; 853 u8 val;
854 854
855 setup_timer(&card->dch.timer, (void *)dbusy_timer_handler, 855 timer_setup(&card->dch.timer, dbusy_timer_handler, 0);
856 (u_long)&card->dch);
857 w6692_mode(&card->bc[0], ISDN_P_NONE); 856 w6692_mode(&card->bc[0], ISDN_P_NONE);
858 w6692_mode(&card->bc[1], ISDN_P_NONE); 857 w6692_mode(&card->bc[1], ISDN_P_NONE);
859 WriteW6692(card, W_D_CTL, 0x00); 858 WriteW6692(card, W_D_CTL, 0x00);
diff --git a/drivers/isdn/mISDN/dsp.h b/drivers/isdn/mISDN/dsp.h
index fc1733a08845..fa09d511a8ed 100644
--- a/drivers/isdn/mISDN/dsp.h
+++ b/drivers/isdn/mISDN/dsp.h
@@ -259,7 +259,7 @@ extern u8 *dsp_dtmf_goertzel_decode(struct dsp *dsp, u8 *data, int len,
259 259
260extern int dsp_tone(struct dsp *dsp, int tone); 260extern int dsp_tone(struct dsp *dsp, int tone);
261extern void dsp_tone_copy(struct dsp *dsp, u8 *data, int len); 261extern void dsp_tone_copy(struct dsp *dsp, u8 *data, int len);
262extern void dsp_tone_timeout(void *arg); 262extern void dsp_tone_timeout(struct timer_list *t);
263 263
264extern void dsp_bf_encrypt(struct dsp *dsp, u8 *data, int len); 264extern void dsp_bf_encrypt(struct dsp *dsp, u8 *data, int len);
265extern void dsp_bf_decrypt(struct dsp *dsp, u8 *data, int len); 265extern void dsp_bf_decrypt(struct dsp *dsp, u8 *data, int len);
diff --git a/drivers/isdn/mISDN/dsp_core.c b/drivers/isdn/mISDN/dsp_core.c
index 880e9d367a39..cd036e87335a 100644
--- a/drivers/isdn/mISDN/dsp_core.c
+++ b/drivers/isdn/mISDN/dsp_core.c
@@ -1092,7 +1092,7 @@ dspcreate(struct channel_req *crq)
1092 ndsp->pcm_bank_tx = -1; 1092 ndsp->pcm_bank_tx = -1;
1093 ndsp->hfc_conf = -1; /* current conference number */ 1093 ndsp->hfc_conf = -1; /* current conference number */
1094 /* set tone timer */ 1094 /* 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);
1096 1096
1097 if (dtmfthreshold < 20 || dtmfthreshold > 500) 1097 if (dtmfthreshold < 20 || dtmfthreshold > 500)
1098 dtmfthreshold = 200; 1098 dtmfthreshold = 200;
@@ -1202,9 +1202,7 @@ static int __init dsp_init(void)
1202 } 1202 }
1203 1203
1204 /* set sample timer */ 1204 /* set sample timer */
1205 dsp_spl_tl.function = (void *)dsp_cmx_send; 1205 timer_setup(&dsp_spl_tl, (void *)dsp_cmx_send, 0);
1206 dsp_spl_tl.data = 0;
1207 init_timer(&dsp_spl_tl);
1208 dsp_spl_tl.expires = jiffies + dsp_tics; 1206 dsp_spl_tl.expires = jiffies + dsp_tics;
1209 dsp_spl_jiffies = dsp_spl_tl.expires; 1207 dsp_spl_jiffies = dsp_spl_tl.expires;
1210 add_timer(&dsp_spl_tl); 1208 add_timer(&dsp_spl_tl);
diff --git a/drivers/isdn/mISDN/dsp_tones.c b/drivers/isdn/mISDN/dsp_tones.c
index 057e0d6a369b..8389e2105cdc 100644
--- a/drivers/isdn/mISDN/dsp_tones.c
+++ b/drivers/isdn/mISDN/dsp_tones.c
@@ -457,9 +457,9 @@ dsp_tone_hw_message(struct dsp *dsp, u8 *sample, int len)
457 * timer expires * 457 * timer expires *
458 *****************/ 458 *****************/
459void 459void
460dsp_tone_timeout(void *arg) 460dsp_tone_timeout(struct timer_list *t)
461{ 461{
462 struct dsp *dsp = arg; 462 struct dsp *dsp = from_timer(dsp, t, tone.tl);
463 struct dsp_tone *tone = &dsp->tone; 463 struct dsp_tone *tone = &dsp->tone;
464 struct pattern *pat = (struct pattern *)tone->pattern; 464 struct pattern *pat = (struct pattern *)tone->pattern;
465 int index = tone->index; 465 int index = tone->index;
@@ -478,7 +478,6 @@ dsp_tone_timeout(void *arg)
478 else 478 else
479 dsp_tone_hw_message(dsp, pat->data[index], *(pat->siz[index])); 479 dsp_tone_hw_message(dsp, pat->data[index], *(pat->siz[index]));
480 /* set timer */ 480 /* set timer */
481 init_timer(&tone->tl);
482 tone->tl.expires = jiffies + (pat->seq[index] * HZ) / 8000; 481 tone->tl.expires = jiffies + (pat->seq[index] * HZ) / 8000;
483 add_timer(&tone->tl); 482 add_timer(&tone->tl);
484} 483}
@@ -541,7 +540,6 @@ dsp_tone(struct dsp *dsp, int tone)
541 /* set timer */ 540 /* set timer */
542 if (timer_pending(&tonet->tl)) 541 if (timer_pending(&tonet->tl))
543 del_timer(&tonet->tl); 542 del_timer(&tonet->tl);
544 init_timer(&tonet->tl);
545 tonet->tl.expires = jiffies + (pat->seq[0] * HZ) / 8000; 543 tonet->tl.expires = jiffies + (pat->seq[0] * HZ) / 8000;
546 add_timer(&tonet->tl); 544 add_timer(&tonet->tl);
547 } else { 545 } else {
diff --git a/drivers/isdn/mISDN/fsm.c b/drivers/isdn/mISDN/fsm.c
index 92e6570b1143..cabcb906e0b5 100644
--- a/drivers/isdn/mISDN/fsm.c
+++ b/drivers/isdn/mISDN/fsm.c
@@ -100,8 +100,9 @@ mISDN_FsmChangeState(struct FsmInst *fi, int newstate)
100EXPORT_SYMBOL(mISDN_FsmChangeState); 100EXPORT_SYMBOL(mISDN_FsmChangeState);
101 101
102static void 102static void
103FsmExpireTimer(struct FsmTimer *ft) 103FsmExpireTimer(struct timer_list *t)
104{ 104{
105 struct FsmTimer *ft = from_timer(ft, t, tl);
105#if FSM_TIMER_DEBUG 106#if FSM_TIMER_DEBUG
106 if (ft->fi->debug) 107 if (ft->fi->debug)
107 ft->fi->printdebug(ft->fi, "FsmExpireTimer %lx", (long) ft); 108 ft->fi->printdebug(ft->fi, "FsmExpireTimer %lx", (long) ft);
@@ -117,7 +118,7 @@ mISDN_FsmInitTimer(struct FsmInst *fi, struct FsmTimer *ft)
117 if (ft->fi->debug) 118 if (ft->fi->debug)
118 ft->fi->printdebug(ft->fi, "mISDN_FsmInitTimer %lx", (long) ft); 119 ft->fi->printdebug(ft->fi, "mISDN_FsmInitTimer %lx", (long) ft);
119#endif 120#endif
120 setup_timer(&ft->tl, (void *)FsmExpireTimer, (long)ft); 121 timer_setup(&ft->tl, FsmExpireTimer, 0);
121} 122}
122EXPORT_SYMBOL(mISDN_FsmInitTimer); 123EXPORT_SYMBOL(mISDN_FsmInitTimer);
123 124
@@ -153,7 +154,6 @@ mISDN_FsmAddTimer(struct FsmTimer *ft,
153 } 154 }
154 return -1; 155 return -1;
155 } 156 }
156 init_timer(&ft->tl);
157 ft->event = event; 157 ft->event = event;
158 ft->arg = arg; 158 ft->arg = arg;
159 ft->tl.expires = jiffies + (millisec * HZ) / 1000; 159 ft->tl.expires = jiffies + (millisec * HZ) / 1000;
@@ -175,7 +175,6 @@ mISDN_FsmRestartTimer(struct FsmTimer *ft,
175 175
176 if (timer_pending(&ft->tl)) 176 if (timer_pending(&ft->tl))
177 del_timer(&ft->tl); 177 del_timer(&ft->tl);
178 init_timer(&ft->tl);
179 ft->event = event; 178 ft->event = event;
180 ft->arg = arg; 179 ft->arg = arg;
181 ft->tl.expires = jiffies + (millisec * HZ) / 1000; 180 ft->tl.expires = jiffies + (millisec * HZ) / 1000;
diff --git a/drivers/isdn/mISDN/l1oip_core.c b/drivers/isdn/mISDN/l1oip_core.c
index 6be2041248d3..b5d590e378ac 100644
--- a/drivers/isdn/mISDN/l1oip_core.c
+++ b/drivers/isdn/mISDN/l1oip_core.c
@@ -842,17 +842,18 @@ l1oip_send_bh(struct work_struct *work)
842 * timer stuff 842 * timer stuff
843 */ 843 */
844static void 844static void
845l1oip_keepalive(void *data) 845l1oip_keepalive(struct timer_list *t)
846{ 846{
847 struct l1oip *hc = (struct l1oip *)data; 847 struct l1oip *hc = from_timer(hc, t, keep_tl);
848 848
849 schedule_work(&hc->workq); 849 schedule_work(&hc->workq);
850} 850}
851 851
852static void 852static void
853l1oip_timeout(void *data) 853l1oip_timeout(struct timer_list *t)
854{ 854{
855 struct l1oip *hc = (struct l1oip *)data; 855 struct l1oip *hc = from_timer(hc, t,
856 timeout_tl);
856 struct dchannel *dch = hc->chan[hc->d_idx].dch; 857 struct dchannel *dch = hc->chan[hc->d_idx].dch;
857 858
858 if (debug & DEBUG_L1OIP_MSG) 859 if (debug & DEBUG_L1OIP_MSG)
@@ -1437,13 +1438,11 @@ init_card(struct l1oip *hc, int pri, int bundle)
1437 if (ret) 1438 if (ret)
1438 return ret; 1439 return ret;
1439 1440
1440 hc->keep_tl.function = (void *)l1oip_keepalive; 1441 timer_setup(&hc->keep_tl, l1oip_keepalive, 0);
1441 hc->keep_tl.data = (ulong)hc;
1442 init_timer(&hc->keep_tl);
1443 hc->keep_tl.expires = jiffies + 2 * HZ; /* two seconds first time */ 1442 hc->keep_tl.expires = jiffies + 2 * HZ; /* two seconds first time */
1444 add_timer(&hc->keep_tl); 1443 add_timer(&hc->keep_tl);
1445 1444
1446 setup_timer(&hc->timeout_tl, (void *)l1oip_timeout, (ulong)hc); 1445 timer_setup(&hc->timeout_tl, l1oip_timeout, 0);
1447 hc->timeout_on = 0; /* state that we have timer off */ 1446 hc->timeout_on = 0; /* state that we have timer off */
1448 1447
1449 return 0; 1448 return 0;
diff --git a/drivers/isdn/mISDN/timerdev.c b/drivers/isdn/mISDN/timerdev.c
index b1e135fc1fb5..c50a34340f67 100644
--- a/drivers/isdn/mISDN/timerdev.c
+++ b/drivers/isdn/mISDN/timerdev.c
@@ -162,9 +162,9 @@ mISDN_poll(struct file *filep, poll_table *wait)
162} 162}
163 163
164static void 164static void
165dev_expire_timer(unsigned long data) 165dev_expire_timer(struct timer_list *t)
166{ 166{
167 struct mISDNtimer *timer = (void *)data; 167 struct mISDNtimer *timer = from_timer(timer, t, tl);
168 u_long flags; 168 u_long flags;
169 169
170 spin_lock_irqsave(&timer->dev->lock, flags); 170 spin_lock_irqsave(&timer->dev->lock, flags);
@@ -189,7 +189,7 @@ misdn_add_timer(struct mISDNtimerdev *dev, int timeout)
189 if (!timer) 189 if (!timer)
190 return -ENOMEM; 190 return -ENOMEM;
191 timer->dev = dev; 191 timer->dev = dev;
192 setup_timer(&timer->tl, dev_expire_timer, (long)timer); 192 timer_setup(&timer->tl, dev_expire_timer, 0);
193 spin_lock_irq(&dev->lock); 193 spin_lock_irq(&dev->lock);
194 id = timer->id = dev->next_id++; 194 id = timer->id = dev->next_id++;
195 if (dev->next_id < 0) 195 if (dev->next_id < 0)