From 05678497276e1ff9394f7f815d80b1f2d47e92f4 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Tue, 24 Oct 2017 03:08:35 -0700 Subject: usb: musb: 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. Instead of a per-device static timer variable, a spare timer "dev_timer" is added to the musb structure for devices to use for their per-device timer. Cc: linux-usb@vger.kernel.org Signed-off-by: Kees Cook Acked-by: Bin Liu Signed-off-by: Greg Kroah-Hartman --- drivers/usb/musb/blackfin.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'drivers/usb/musb/blackfin.c') diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c index 4418574..7c580df 100644 --- a/drivers/usb/musb/blackfin.c +++ b/drivers/usb/musb/blackfin.c @@ -223,7 +223,7 @@ static irqreturn_t blackfin_interrupt(int irq, void *__hci) if ((musb->xceiv->otg->state == OTG_STATE_B_IDLE || musb->xceiv->otg->state == OTG_STATE_A_WAIT_BCON) || (musb->int_usb & MUSB_INTR_DISCONNECT && is_host_active(musb))) { - mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY); + mod_timer(&musb->dev_timer, jiffies + TIMER_DELAY); musb->a_wait_bcon = TIMER_DELAY; } @@ -232,9 +232,9 @@ static irqreturn_t blackfin_interrupt(int irq, void *__hci) return retval; } -static void musb_conn_timer_handler(unsigned long _musb) +static void musb_conn_timer_handler(struct timer_list *t) { - struct musb *musb = (void *)_musb; + struct musb *musb = from_timer(musb, t, dev_timer); unsigned long flags; u16 val; static u8 toggle; @@ -266,7 +266,7 @@ static void musb_conn_timer_handler(unsigned long _musb) musb_writeb(musb->mregs, MUSB_INTRUSB, val); musb->xceiv->otg->state = OTG_STATE_B_IDLE; } - mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY); + mod_timer(&musb->dev_timer, jiffies + TIMER_DELAY); break; case OTG_STATE_B_IDLE: /* @@ -310,7 +310,7 @@ static void musb_conn_timer_handler(unsigned long _musb) * shortening it, if accelerating A-plug detection * is needed in OTG mode. */ - mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY / 4); + mod_timer(&musb->dev_timer, jiffies + TIMER_DELAY / 4); } break; default: @@ -445,8 +445,7 @@ static int bfin_musb_init(struct musb *musb) bfin_musb_reg_init(musb); - setup_timer(&musb_conn_timer, musb_conn_timer_handler, - (unsigned long) musb); + timer_setup(&musb->dev_timer, musb_conn_timer_handler, 0); musb->xceiv->set_power = bfin_musb_set_power; -- cgit v1.1