aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-01-19 05:29:42 -0500
committerTakashi Iwai <tiwai@suse.de>2015-01-19 05:32:28 -0500
commitf05b4127730f16641de8cc39cd79b30120d37b51 (patch)
tree608b5d183e74245a4b40081274e2a9ee51370013
parent867a0e057f69a06e032f779efd4325ef632084af (diff)
ALSA: sb: Use setup_timer() and mod_timer()
No functional change, refactoring with the standard helpers. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/isa/sb/emu8000_pcm.c10
-rw-r--r--sound/isa/sb/sb8_midi.c12
2 files changed, 8 insertions, 14 deletions
diff --git a/sound/isa/sb/emu8000_pcm.c b/sound/isa/sb/emu8000_pcm.c
index 2f85c66f8e38..250fd0006b53 100644
--- a/sound/isa/sb/emu8000_pcm.c
+++ b/sound/isa/sb/emu8000_pcm.c
@@ -207,8 +207,7 @@ static void emu8k_pcm_timer_func(unsigned long data)
207 rec->last_ptr = ptr; 207 rec->last_ptr = ptr;
208 208
209 /* reprogram timer */ 209 /* reprogram timer */
210 rec->timer.expires = jiffies + 1; 210 mod_timer(&rec->timer, jiffies + 1);
211 add_timer(&rec->timer);
212 211
213 /* update period */ 212 /* update period */
214 if (rec->period_pos >= (int)rec->period_size) { 213 if (rec->period_pos >= (int)rec->period_size) {
@@ -240,9 +239,7 @@ static int emu8k_pcm_open(struct snd_pcm_substream *subs)
240 runtime->private_data = rec; 239 runtime->private_data = rec;
241 240
242 spin_lock_init(&rec->timer_lock); 241 spin_lock_init(&rec->timer_lock);
243 init_timer(&rec->timer); 242 setup_timer(&rec->timer, emu8k_pcm_timer_func, (unsigned long)rec);
244 rec->timer.function = emu8k_pcm_timer_func;
245 rec->timer.data = (unsigned long)rec;
246 243
247 runtime->hw = emu8k_pcm_hw; 244 runtime->hw = emu8k_pcm_hw;
248 runtime->hw.buffer_bytes_max = emu->mem_size - LOOP_BLANK_SIZE * 3; 245 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)
359 /* start timer */ 356 /* start timer */
360 spin_lock_irqsave(&rec->timer_lock, flags); 357 spin_lock_irqsave(&rec->timer_lock, flags);
361 if (! rec->timer_running) { 358 if (! rec->timer_running) {
362 rec->timer.expires = jiffies + 1; 359 mod_timer(&rec->timer, jiffies + 1);
363 add_timer(&rec->timer);
364 rec->timer_running = 1; 360 rec->timer_running = 1;
365 } 361 }
366 spin_unlock_irqrestore(&rec->timer_lock, flags); 362 spin_unlock_irqrestore(&rec->timer_lock, flags);
diff --git a/sound/isa/sb/sb8_midi.c b/sound/isa/sb/sb8_midi.c
index ffc71f0267df..925ea45b3d97 100644
--- a/sound/isa/sb/sb8_midi.c
+++ b/sound/isa/sb/sb8_midi.c
@@ -216,8 +216,7 @@ static void snd_sb8dsp_midi_output_timer(unsigned long data)
216 unsigned long flags; 216 unsigned long flags;
217 217
218 spin_lock_irqsave(&chip->open_lock, flags); 218 spin_lock_irqsave(&chip->open_lock, flags);
219 chip->midi_timer.expires = 1 + jiffies; 219 mod_timer(&chip->midi_timer, 1 + jiffies);
220 add_timer(&chip->midi_timer);
221 spin_unlock_irqrestore(&chip->open_lock, flags); 220 spin_unlock_irqrestore(&chip->open_lock, flags);
222 snd_sb8dsp_midi_output_write(substream); 221 snd_sb8dsp_midi_output_write(substream);
223} 222}
@@ -231,11 +230,10 @@ static void snd_sb8dsp_midi_output_trigger(struct snd_rawmidi_substream *substre
231 spin_lock_irqsave(&chip->open_lock, flags); 230 spin_lock_irqsave(&chip->open_lock, flags);
232 if (up) { 231 if (up) {
233 if (!(chip->open & SB_OPEN_MIDI_OUTPUT_TRIGGER)) { 232 if (!(chip->open & SB_OPEN_MIDI_OUTPUT_TRIGGER)) {
234 init_timer(&chip->midi_timer); 233 setup_timer(&chip->midi_timer,
235 chip->midi_timer.function = snd_sb8dsp_midi_output_timer; 234 snd_sb8dsp_midi_output_timer,
236 chip->midi_timer.data = (unsigned long) substream; 235 (unsigned long) substream);
237 chip->midi_timer.expires = 1 + jiffies; 236 mod_timer(&chip->midi_timer, 1 + jiffies);
238 add_timer(&chip->midi_timer);
239 chip->open |= SB_OPEN_MIDI_OUTPUT_TRIGGER; 237 chip->open |= SB_OPEN_MIDI_OUTPUT_TRIGGER;
240 } 238 }
241 } else { 239 } else {