diff mbox

[4/7] ALSA: line6/toneport: Move setup_timer() at the beginning

Message ID 1421744662-6497-5-git-send-email-tiwai@suse.de (mailing list archive)
State Accepted
Commit 6dd1c05cd7c26a463bbcca1ab50b59b86d88de64
Headers show

Commit Message

Takashi Iwai Jan. 20, 2015, 9:04 a.m. UTC
... so that timer_del_sync() in the destructor can be called safely at
any time.  Also move the mod_timer() call in toneport_setup(), which
is a bit clearer place.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/usb/line6/toneport.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/sound/usb/line6/toneport.c b/sound/usb/line6/toneport.c
index e5669bd3233a..fb6d5e1e2ade 100644
--- a/sound/usb/line6/toneport.c
+++ b/sound/usb/line6/toneport.c
@@ -360,6 +360,8 @@  static void toneport_setup(struct usb_line6_toneport *toneport)
 
 	if (toneport_has_led(toneport->type))
 		toneport_update_led(&usbdev->dev);
+
+	mod_timer(&toneport->timer, jiffies + TONEPORT_PCM_DELAY * HZ);
 }
 
 /*
@@ -390,6 +392,9 @@  static int toneport_init(struct usb_interface *interface,
 	int err;
 	struct usb_line6_toneport *toneport =  (struct usb_line6_toneport *) line6;
 
+	setup_timer(&toneport->timer, toneport_start_pcm,
+		    (unsigned long)toneport);
+
 	line6->disconnect = line6_toneport_disconnect;
 
 	/* initialize PCM subsystem: */
@@ -435,10 +440,6 @@  static int toneport_init(struct usb_interface *interface,
 
 	toneport_setup(toneport);
 
-	setup_timer(&toneport->timer, toneport_start_pcm,
-		    (unsigned long)toneport);
-	mod_timer(&toneport->timer, jiffies + TONEPORT_PCM_DELAY * HZ);
-
 	/* register audio system: */
 	return snd_card_register(line6->card);
 }