ALSA: sb: Use setup_timer() and mod_timer()
authorTakashi Iwai <tiwai@suse.de>
Mon, 19 Jan 2015 10:29:42 +0000 (11:29 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 19 Jan 2015 10:32:28 +0000 (11:32 +0100)
No functional change, refactoring with the standard helpers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/isa/sb/emu8000_pcm.c
sound/isa/sb/sb8_midi.c

index 2f85c66f8e383c9feed771021a66626d775a4947..250fd0006b5360fb5ac2befd534e38c9cd5a7a20 100644 (file)
@@ -207,8 +207,7 @@ static void emu8k_pcm_timer_func(unsigned long data)
        rec->last_ptr = ptr;
 
        /* reprogram timer */
-       rec->timer.expires = jiffies + 1;
-       add_timer(&rec->timer);
+       mod_timer(&rec->timer, jiffies + 1);
 
        /* update period */
        if (rec->period_pos >= (int)rec->period_size) {
@@ -240,9 +239,7 @@ static int emu8k_pcm_open(struct snd_pcm_substream *subs)
        runtime->private_data = rec;
 
        spin_lock_init(&rec->timer_lock);
-       init_timer(&rec->timer);
-       rec->timer.function = emu8k_pcm_timer_func;
-       rec->timer.data = (unsigned long)rec;
+       setup_timer(&rec->timer, emu8k_pcm_timer_func, (unsigned long)rec);
 
        runtime->hw = emu8k_pcm_hw;
        runtime->hw.buffer_bytes_max = emu->mem_size - LOOP_BLANK_SIZE * 3;
@@ -359,8 +356,7 @@ static void start_voice(struct snd_emu8k_pcm *rec, int ch)
        /* start timer */
        spin_lock_irqsave(&rec->timer_lock, flags);
        if (! rec->timer_running) {
-               rec->timer.expires = jiffies + 1;
-               add_timer(&rec->timer);
+               mod_timer(&rec->timer, jiffies + 1);
                rec->timer_running = 1;
        }
        spin_unlock_irqrestore(&rec->timer_lock, flags);
index ffc71f0267dff3a4c5609dac543c37353cf93f50..925ea45b3d97e882b33bddafada5100b15a23a3a 100644 (file)
@@ -216,8 +216,7 @@ static void snd_sb8dsp_midi_output_timer(unsigned long data)
        unsigned long flags;
 
        spin_lock_irqsave(&chip->open_lock, flags);
-       chip->midi_timer.expires = 1 + jiffies;
-       add_timer(&chip->midi_timer);
+       mod_timer(&chip->midi_timer, 1 + jiffies);
        spin_unlock_irqrestore(&chip->open_lock, flags);        
        snd_sb8dsp_midi_output_write(substream);
 }
@@ -231,11 +230,10 @@ static void snd_sb8dsp_midi_output_trigger(struct snd_rawmidi_substream *substre
        spin_lock_irqsave(&chip->open_lock, flags);
        if (up) {
                if (!(chip->open & SB_OPEN_MIDI_OUTPUT_TRIGGER)) {
-                       init_timer(&chip->midi_timer);
-                       chip->midi_timer.function = snd_sb8dsp_midi_output_timer;
-                       chip->midi_timer.data = (unsigned long) substream;
-                       chip->midi_timer.expires = 1 + jiffies;
-                       add_timer(&chip->midi_timer);
+                       setup_timer(&chip->midi_timer,
+                                   snd_sb8dsp_midi_output_timer,
+                                   (unsigned long) substream);
+                       mod_timer(&chip->midi_timer, 1 + jiffies);
                        chip->open |= SB_OPEN_MIDI_OUTPUT_TRIGGER;
                }
        } else {