diff options
Diffstat (limited to 'drivers/usb/musb/tusb6010.c')
-rw-r--r-- | drivers/usb/musb/tusb6010.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index 4eb640c54f2c..39453287b5c3 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c @@ -1,13 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* * TUSB6010 USB 2.0 OTG Dual Role controller * * Copyright (C) 2006 Nokia Corporation * Tony Lindgren <tony@atomide.com> * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * * Notes: * - Driver assumes that interface to external host (main CPU) is * configured for NOR FLASH interface instead of VLYNQ serial @@ -452,11 +449,9 @@ static int tusb_musb_vbus_status(struct musb *musb) return ret; } -static struct timer_list musb_idle_timer; - -static void musb_do_idle(unsigned long _musb) +static void musb_do_idle(struct timer_list *t) { - struct musb *musb = (void *)_musb; + struct musb *musb = from_timer(musb, t, dev_timer); unsigned long flags; spin_lock_irqsave(&musb->lock, flags); @@ -523,13 +518,13 @@ static void tusb_musb_try_idle(struct musb *musb, unsigned long timeout) && (musb->xceiv->otg->state == OTG_STATE_A_WAIT_BCON))) { dev_dbg(musb->controller, "%s active, deleting timer\n", usb_otg_state_string(musb->xceiv->otg->state)); - del_timer(&musb_idle_timer); + del_timer(&musb->dev_timer); last_timer = jiffies; return; } if (time_after(last_timer, timeout)) { - if (!timer_pending(&musb_idle_timer)) + if (!timer_pending(&musb->dev_timer)) last_timer = timeout; else { dev_dbg(musb->controller, "Longer idle timer already pending, ignoring\n"); @@ -541,7 +536,7 @@ static void tusb_musb_try_idle(struct musb *musb, unsigned long timeout) dev_dbg(musb->controller, "%s inactive, for idle timer for %lu ms\n", usb_otg_state_string(musb->xceiv->otg->state), (unsigned long)jiffies_to_msecs(timeout - jiffies)); - mod_timer(&musb_idle_timer, timeout); + mod_timer(&musb->dev_timer, timeout); } /* ticks of 60 MHz clock */ @@ -873,7 +868,7 @@ static irqreturn_t tusb_musb_interrupt(int irq, void *__hci) } if (int_src & TUSB_INT_SRC_USB_IP_CONN) - del_timer(&musb_idle_timer); + del_timer(&musb->dev_timer); /* OTG state change reports (annoyingly) not issued by Mentor core */ if (int_src & (TUSB_INT_SRC_VBUS_SENSE_CHNG @@ -982,7 +977,7 @@ static void tusb_musb_disable(struct musb *musb) musb_writel(tbase, TUSB_DMA_INT_MASK, 0x7fffffff); musb_writel(tbase, TUSB_GPIO_INT_MASK, 0x1ff); - del_timer(&musb_idle_timer); + del_timer(&musb->dev_timer); if (is_dma_capable() && !dma_off) { printk(KERN_WARNING "%s %s: dma still active\n", @@ -1142,7 +1137,7 @@ static int tusb_musb_init(struct musb *musb) musb->xceiv->set_power = tusb_draw_power; the_musb = musb; - setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb); + timer_setup(&musb->dev_timer, musb_do_idle, 0); done: if (ret < 0) { @@ -1156,7 +1151,7 @@ done: static int tusb_musb_exit(struct musb *musb) { - del_timer_sync(&musb_idle_timer); + del_timer_sync(&musb->dev_timer); the_musb = NULL; if (musb->board_set_power) |