ALSA: dummy: use setup_timer and mod_timer
authorRoman Kollar <rkollar@mail.muni.cz>
Mon, 19 Jan 2015 09:42:54 +0000 (10:42 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 19 Jan 2015 09:49:52 +0000 (10:49 +0100)
Use setup_timer and mod_timer instead of structure assignments as it
is the preferred way to setup and set the timer.

Signed-off-by: Roman Kollar <rkollar@mail.muni.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/drivers/dummy.c

index 5d0dfb787cece4e9cfc4eb95e09ea6ba6ffb38a6..d11baaf0f0b4a43d63b5e805ab970e72755e2605 100644 (file)
@@ -245,9 +245,8 @@ struct dummy_systimer_pcm {
 
 static void dummy_systimer_rearm(struct dummy_systimer_pcm *dpcm)
 {
-       dpcm->timer.expires = jiffies +
-               (dpcm->frac_period_rest + dpcm->rate - 1) / dpcm->rate;
-       add_timer(&dpcm->timer);
+       mod_timer(&dpcm->timer, jiffies +
+               (dpcm->frac_period_rest + dpcm->rate - 1) / dpcm->rate);
 }
 
 static void dummy_systimer_update(struct dummy_systimer_pcm *dpcm)
@@ -340,9 +339,8 @@ static int dummy_systimer_create(struct snd_pcm_substream *substream)
        if (!dpcm)
                return -ENOMEM;
        substream->runtime->private_data = dpcm;
-       init_timer(&dpcm->timer);
-       dpcm->timer.data = (unsigned long) dpcm;
-       dpcm->timer.function = dummy_systimer_callback;
+       setup_timer(&dpcm->timer, dummy_systimer_callback,
+                       (unsigned long) dpcm);
        spin_lock_init(&dpcm->lock);
        dpcm->substream = substream;
        return 0;