diff options
author | Kees Cook <keescook@chromium.org> | 2017-10-24 13:08:35 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-11-01 18:48:10 +0300 |
commit | 05678497276e1ff9394f7f815d80b1f2d47e92f4 (patch) | |
tree | bdcf8b49cacaf68fd4609662226755dba98c410c /drivers/usb/musb/blackfin.c | |
parent | 0c63636440504f0f14cc3da5fb208eeb1598a840 (diff) | |
download | linux-05678497276e1ff9394f7f815d80b1f2d47e92f4.tar.xz |
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 <keescook@chromium.org>
Acked-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/musb/blackfin.c')
-rw-r--r-- | drivers/usb/musb/blackfin.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c index 4418574a36a1..7c580df75dc1 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; |