Commit 5e8b824d authored by Kees Cook's avatar Kees Cook Committed by David S. Miller
Browse files

isdn/hisax: 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: netdev@vger.kernel.org
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d8eb7e26
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -398,7 +398,6 @@ Amd7930_fill_Dfifo(struct IsdnCardState *cs)
		debugl1(cs, "Amd7930: fill_Dfifo dbusytimer running");
		del_timer(&cs->dbusytimer);
	}
	init_timer(&cs->dbusytimer);
	cs->dbusytimer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ) / 1000);
	add_timer(&cs->dbusytimer);

@@ -686,8 +685,9 @@ DC_Close_Amd7930(struct IsdnCardState *cs) {


static void
dbusy_timer_handler(struct IsdnCardState *cs)
dbusy_timer_handler(struct timer_list *t)
{
	struct IsdnCardState *cs = from_timer(cs, t, dbusytimer);
	u_long flags;
	struct PStack *stptr;
	WORD dtcr, der;
@@ -790,5 +790,5 @@ void Amd7930_init(struct IsdnCardState *cs)
void setup_Amd7930(struct IsdnCardState *cs)
{
	INIT_WORK(&cs->tqueue, Amd7930_bh);
	setup_timer(&cs->dbusytimer, (void *)dbusy_timer_handler, (long)cs);
	timer_setup(&cs->dbusytimer, dbusy_timer_handler, 0);
}
+3 −3
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ add_arcofi_timer(struct IsdnCardState *cs) {
	if (test_and_set_bit(FLG_ARCOFI_TIMER, &cs->HW_Flags)) {
		del_timer(&cs->dc.isac.arcofitimer);
	}
	init_timer(&cs->dc.isac.arcofitimer);
	cs->dc.isac.arcofitimer.expires = jiffies + ((ARCOFI_TIMER_VALUE * HZ) / 1000);
	add_timer(&cs->dc.isac.arcofitimer);
}
@@ -112,7 +111,8 @@ arcofi_fsm(struct IsdnCardState *cs, int event, void *data) {
}

static void
arcofi_timer(struct IsdnCardState *cs) {
arcofi_timer(struct timer_list *t) {
	struct IsdnCardState *cs = from_timer(cs, t, dc.isac.arcofitimer);
	arcofi_fsm(cs, ARCOFI_TIMEOUT, NULL);
}

@@ -125,7 +125,7 @@ clear_arcofi(struct IsdnCardState *cs) {

void
init_arcofi(struct IsdnCardState *cs) {
	setup_timer(&cs->dc.isac.arcofitimer, (void *)arcofi_timer, (long)cs);
	timer_setup(&cs->dc.isac.arcofitimer, arcofi_timer, 0);
	init_waitqueue_head(&cs->dc.isac.arcofi_wait);
	test_and_set_bit(HW_ARCOFI, &cs->HW_Flags);
}
+4 −5
Original line number Diff line number Diff line
@@ -798,8 +798,9 @@ reset_diva(struct IsdnCardState *cs)
#define DIVA_ASSIGN 1

static void
diva_led_handler(struct IsdnCardState *cs)
diva_led_handler(struct timer_list *t)
{
	struct IsdnCardState *cs = from_timer(cs, t, hw.diva.tl);
	int blink = 0;

	if ((cs->subtyp == DIVA_IPAC_ISA) ||
@@ -828,7 +829,6 @@ diva_led_handler(struct IsdnCardState *cs)

	byteout(cs->hw.diva.ctrl, cs->hw.diva.ctrl_reg);
	if (blink) {
		init_timer(&cs->hw.diva.tl);
		cs->hw.diva.tl.expires = jiffies + ((blink * HZ) / 1000);
		add_timer(&cs->hw.diva.tl);
	}
@@ -900,7 +900,7 @@ Diva_card_msg(struct IsdnCardState *cs, int mt, void *arg)
	    (cs->subtyp != DIVA_IPAC_PCI) &&
	    (cs->subtyp != DIVA_IPACX_PCI)) {
		spin_lock_irqsave(&cs->lock, flags);
		diva_led_handler(cs);
		diva_led_handler(&cs->hw.diva.tl);
		spin_unlock_irqrestore(&cs->lock, flags);
	}
	return (0);
@@ -978,8 +978,7 @@ static int setup_diva_common(struct IsdnCardState *cs)
		printk(KERN_INFO "Diva: IPACX Design Id: %x\n",
		       MemReadISAC_IPACX(cs, IPACX_ID) & 0x3F);
	} else { /* DIVA 2.0 */
		setup_timer(&cs->hw.diva.tl, (void *)diva_led_handler,
			    (long)cs);
		timer_setup(&cs->hw.diva.tl, diva_led_handler, 0);
		cs->readisac  = &ReadISAC;
		cs->writeisac = &WriteISAC;
		cs->readisacfifo  = &ReadISACfifo;
+5 −5
Original line number Diff line number Diff line
@@ -606,8 +606,9 @@ check_arcofi(struct IsdnCardState *cs)
#endif /* ARCOFI_USE */

static void
elsa_led_handler(struct IsdnCardState *cs)
elsa_led_handler(struct timer_list *t)
{
	struct IsdnCardState *cs = from_timer(cs, t, hw.elsa.tl);
	int blink = 0;

	if (cs->subtyp == ELSA_PCMCIA || cs->subtyp == ELSA_PCMCIA_IPAC)
@@ -640,7 +641,6 @@ elsa_led_handler(struct IsdnCardState *cs)
	} else
		byteout(cs->hw.elsa.ctrl, cs->hw.elsa.ctrl_reg);
	if (blink) {
		init_timer(&cs->hw.elsa.tl);
		cs->hw.elsa.tl.expires = jiffies + ((blink * HZ) / 1000);
		add_timer(&cs->hw.elsa.tl);
	}
@@ -715,7 +715,7 @@ Elsa_card_msg(struct IsdnCardState *cs, int mt, void *arg)
			init_modem(cs);
		}
#endif
		elsa_led_handler(cs);
		elsa_led_handler(&cs->hw.elsa.tl);
		return (ret);
	case (MDL_REMOVE | REQUEST):
		cs->hw.elsa.status &= 0;
@@ -767,7 +767,7 @@ Elsa_card_msg(struct IsdnCardState *cs, int mt, void *arg)
		else
			cs->hw.elsa.status &= ~ELSA_BAD_PWR;
	}
	elsa_led_handler(cs);
	elsa_led_handler(&cs->hw.elsa.tl);
	return (ret);
}

@@ -1147,7 +1147,7 @@ static int setup_elsa_common(struct IsdnCard *card)
	init_arcofi(cs);
#endif
	setup_isac(cs);
	setup_timer(&cs->hw.elsa.tl, (void *)elsa_led_handler, (long)cs);
	timer_setup(&cs->hw.elsa.tl, elsa_led_handler, 0);
	/* Teste Timer */
	if (cs->hw.elsa.timer) {
		byteout(cs->hw.elsa.trig, 0xff);
+3 −4
Original line number Diff line number Diff line
@@ -85,8 +85,9 @@ FsmChangeState(struct FsmInst *fi, int newstate)
}

static void
FsmExpireTimer(struct FsmTimer *ft)
FsmExpireTimer(struct timer_list *t)
{
	struct FsmTimer *ft = from_timer(ft, t, tl);
#if FSM_TIMER_DEBUG
	if (ft->fi->debug)
		ft->fi->printdebug(ft->fi, "FsmExpireTimer %lx", (long) ft);
@@ -102,7 +103,7 @@ FsmInitTimer(struct FsmInst *fi, struct FsmTimer *ft)
	if (ft->fi->debug)
		ft->fi->printdebug(ft->fi, "FsmInitTimer %lx", (long) ft);
#endif
	setup_timer(&ft->tl, (void *)FsmExpireTimer, (long)ft);
	timer_setup(&ft->tl, FsmExpireTimer, 0);
}

void
@@ -131,7 +132,6 @@ FsmAddTimer(struct FsmTimer *ft,
		ft->fi->printdebug(ft->fi, "FsmAddTimer already active!");
		return -1;
	}
	init_timer(&ft->tl);
	ft->event = event;
	ft->arg = arg;
	ft->tl.expires = jiffies + (millisec * HZ) / 1000;
@@ -152,7 +152,6 @@ FsmRestartTimer(struct FsmTimer *ft,

	if (timer_pending(&ft->tl))
		del_timer(&ft->tl);
	init_timer(&ft->tl);
	ft->event = event;
	ft->arg = arg;
	ft->tl.expires = jiffies + (millisec * HZ) / 1000;
Loading