Commit 3b15d0d5 authored by Takashi Iwai's avatar Takashi Iwai

Merge branch 'topic/timer-cleanup' into for-next

parents 86b5f3ec 28e237a9
...@@ -1030,9 +1030,7 @@ static int snd_timer_register_system(void) ...@@ -1030,9 +1030,7 @@ static int snd_timer_register_system(void)
snd_timer_free(timer); snd_timer_free(timer);
return -ENOMEM; return -ENOMEM;
} }
init_timer(&priv->tlist); setup_timer(&priv->tlist, snd_timer_s_function, (unsigned long) timer);
priv->tlist.function = snd_timer_s_function;
priv->tlist.data = (unsigned long) timer;
timer->private_data = priv; timer->private_data = priv;
timer->private_free = snd_timer_free_system; timer->private_free = snd_timer_free_system;
return snd_timer_global_register(timer); return snd_timer_global_register(timer);
......
...@@ -181,8 +181,7 @@ static void loopback_timer_start(struct loopback_pcm *dpcm) ...@@ -181,8 +181,7 @@ static void loopback_timer_start(struct loopback_pcm *dpcm)
} }
tick = dpcm->period_size_frac - dpcm->irq_pos; tick = dpcm->period_size_frac - dpcm->irq_pos;
tick = (tick + dpcm->pcm_bps - 1) / dpcm->pcm_bps; tick = (tick + dpcm->pcm_bps - 1) / dpcm->pcm_bps;
dpcm->timer.expires = jiffies + tick; mod_timer(&dpcm->timer, jiffies + tick);
add_timer(&dpcm->timer);
} }
/* call in cable->lock */ /* call in cable->lock */
......
...@@ -176,8 +176,7 @@ static void snd_mpu401_uart_timer(unsigned long data) ...@@ -176,8 +176,7 @@ static void snd_mpu401_uart_timer(unsigned long data)
spin_lock_irqsave(&mpu->timer_lock, flags); spin_lock_irqsave(&mpu->timer_lock, flags);
/*mpu->mode |= MPU401_MODE_TIMER;*/ /*mpu->mode |= MPU401_MODE_TIMER;*/
mpu->timer.expires = 1 + jiffies; mod_timer(&mpu->timer, 1 + jiffies);
add_timer(&mpu->timer);
spin_unlock_irqrestore(&mpu->timer_lock, flags); spin_unlock_irqrestore(&mpu->timer_lock, flags);
if (mpu->rmidi) if (mpu->rmidi)
_snd_mpu401_uart_interrupt(mpu); _snd_mpu401_uart_interrupt(mpu);
...@@ -192,11 +191,9 @@ static void snd_mpu401_uart_add_timer (struct snd_mpu401 *mpu, int input) ...@@ -192,11 +191,9 @@ static void snd_mpu401_uart_add_timer (struct snd_mpu401 *mpu, int input)
spin_lock_irqsave (&mpu->timer_lock, flags); spin_lock_irqsave (&mpu->timer_lock, flags);
if (mpu->timer_invoked == 0) { if (mpu->timer_invoked == 0) {
init_timer(&mpu->timer); setup_timer(&mpu->timer, snd_mpu401_uart_timer,
mpu->timer.data = (unsigned long)mpu; (unsigned long)mpu);
mpu->timer.function = snd_mpu401_uart_timer; mod_timer(&mpu->timer, 1 + jiffies);
mpu->timer.expires = 1 + jiffies;
add_timer(&mpu->timer);
} }
mpu->timer_invoked |= input ? MPU401_MODE_INPUT_TIMER : mpu->timer_invoked |= input ? MPU401_MODE_INPUT_TIMER :
MPU401_MODE_OUTPUT_TIMER; MPU401_MODE_OUTPUT_TIMER;
......
...@@ -414,8 +414,7 @@ static void snd_mtpav_output_timer(unsigned long data) ...@@ -414,8 +414,7 @@ static void snd_mtpav_output_timer(unsigned long data)
spin_lock_irqsave(&chip->spinlock, flags); spin_lock_irqsave(&chip->spinlock, flags);
/* reprogram timer */ /* reprogram timer */
chip->timer.expires = 1 + jiffies; mod_timer(&chip->timer, 1 + jiffies);
add_timer(&chip->timer);
/* process each port */ /* process each port */
for (p = 0; p <= chip->num_ports * 2 + MTPAV_PIDX_BROADCAST; p++) { for (p = 0; p <= chip->num_ports * 2 + MTPAV_PIDX_BROADCAST; p++) {
struct mtpav_port *portp = &chip->ports[p]; struct mtpav_port *portp = &chip->ports[p];
...@@ -428,8 +427,7 @@ static void snd_mtpav_output_timer(unsigned long data) ...@@ -428,8 +427,7 @@ static void snd_mtpav_output_timer(unsigned long data)
/* spinlock held! */ /* spinlock held! */
static void snd_mtpav_add_output_timer(struct mtpav *chip) static void snd_mtpav_add_output_timer(struct mtpav *chip)
{ {
chip->timer.expires = 1 + jiffies; mod_timer(&chip->timer, 1 + jiffies);
add_timer(&chip->timer);
} }
/* spinlock held! */ /* spinlock held! */
...@@ -704,15 +702,13 @@ static int snd_mtpav_probe(struct platform_device *dev) ...@@ -704,15 +702,13 @@ static int snd_mtpav_probe(struct platform_device *dev)
mtp_card = card->private_data; mtp_card = card->private_data;
spin_lock_init(&mtp_card->spinlock); spin_lock_init(&mtp_card->spinlock);
init_timer(&mtp_card->timer);
mtp_card->card = card; mtp_card->card = card;
mtp_card->irq = -1; mtp_card->irq = -1;
mtp_card->share_irq = 0; mtp_card->share_irq = 0;
mtp_card->inmidistate = 0; mtp_card->inmidistate = 0;
mtp_card->outmidihwport = 0xffffffff; mtp_card->outmidihwport = 0xffffffff;
init_timer(&mtp_card->timer); setup_timer(&mtp_card->timer, snd_mtpav_output_timer,
mtp_card->timer.function = snd_mtpav_output_timer; (unsigned long) mtp_card);
mtp_card->timer.data = (unsigned long) mtp_card;
card->private_free = snd_mtpav_free; card->private_free = snd_mtpav_free;
......
...@@ -258,12 +258,10 @@ void snd_opl3_timer_func(unsigned long data) ...@@ -258,12 +258,10 @@ void snd_opl3_timer_func(unsigned long data)
spin_unlock_irqrestore(&opl3->voice_lock, flags); spin_unlock_irqrestore(&opl3->voice_lock, flags);
spin_lock_irqsave(&opl3->sys_timer_lock, flags); spin_lock_irqsave(&opl3->sys_timer_lock, flags);
if (again) { if (again)
opl3->tlist.expires = jiffies + 1; /* invoke again */ mod_timer(&opl3->tlist, jiffies + 1); /* invoke again */
add_timer(&opl3->tlist); else
} else {
opl3->sys_timer_status = 0; opl3->sys_timer_status = 0;
}
spin_unlock_irqrestore(&opl3->sys_timer_lock, flags); spin_unlock_irqrestore(&opl3->sys_timer_lock, flags);
} }
...@@ -275,8 +273,7 @@ static void snd_opl3_start_timer(struct snd_opl3 *opl3) ...@@ -275,8 +273,7 @@ static void snd_opl3_start_timer(struct snd_opl3 *opl3)
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&opl3->sys_timer_lock, flags); spin_lock_irqsave(&opl3->sys_timer_lock, flags);
if (! opl3->sys_timer_status) { if (! opl3->sys_timer_status) {
opl3->tlist.expires = jiffies + 1; mod_timer(&opl3->tlist, jiffies + 1);
add_timer(&opl3->tlist);
opl3->sys_timer_status = 1; opl3->sys_timer_status = 1;
} }
spin_unlock_irqrestore(&opl3->sys_timer_lock, flags); spin_unlock_irqrestore(&opl3->sys_timer_lock, flags);
......
...@@ -247,9 +247,7 @@ static int snd_opl3_seq_new_device(struct snd_seq_device *dev) ...@@ -247,9 +247,7 @@ static int snd_opl3_seq_new_device(struct snd_seq_device *dev)
} }
/* setup system timer */ /* setup system timer */
init_timer(&opl3->tlist); setup_timer(&opl3->tlist, snd_opl3_timer_func, (unsigned long) opl3);
opl3->tlist.function = snd_opl3_timer_func;
opl3->tlist.data = (unsigned long) opl3;
spin_lock_init(&opl3->sys_timer_lock); spin_lock_init(&opl3->sys_timer_lock);
opl3->sys_timer_status = 0; opl3->sys_timer_status = 0;
......
...@@ -174,9 +174,8 @@ static inline void snd_uart16550_add_timer(struct snd_uart16550 *uart) ...@@ -174,9 +174,8 @@ static inline void snd_uart16550_add_timer(struct snd_uart16550 *uart)
{ {
if (!uart->timer_running) { if (!uart->timer_running) {
/* timer 38600bps * 10bit * 16byte */ /* timer 38600bps * 10bit * 16byte */
uart->buffer_timer.expires = jiffies + (HZ+255)/256; mod_timer(&uart->buffer_timer, jiffies + (HZ + 255) / 256);
uart->timer_running = 1; uart->timer_running = 1;
add_timer(&uart->buffer_timer);
} }
} }
...@@ -830,9 +829,8 @@ static int snd_uart16550_create(struct snd_card *card, ...@@ -830,9 +829,8 @@ static int snd_uart16550_create(struct snd_card *card,
uart->prev_in = 0; uart->prev_in = 0;
uart->rstatus = 0; uart->rstatus = 0;
memset(uart->prev_status, 0x80, sizeof(unsigned char) * SNDRV_SERIAL_MAX_OUTS); memset(uart->prev_status, 0x80, sizeof(unsigned char) * SNDRV_SERIAL_MAX_OUTS);
init_timer(&uart->buffer_timer); setup_timer(&uart->buffer_timer, snd_uart16550_buffer_timer,
uart->buffer_timer.function = snd_uart16550_buffer_timer; (unsigned long)uart);
uart->buffer_timer.data = (unsigned long)uart;
uart->timer_running = 0; uart->timer_running = 0;
/* Register device */ /* Register device */
......
...@@ -91,9 +91,7 @@ int snd_ak4117_create(struct snd_card *card, ak4117_read_t *read, ak4117_write_t ...@@ -91,9 +91,7 @@ int snd_ak4117_create(struct snd_card *card, ak4117_read_t *read, ak4117_write_t
chip->read = read; chip->read = read;
chip->write = write; chip->write = write;
chip->private_data = private_data; chip->private_data = private_data;
init_timer(&chip->timer); setup_timer(&chip->timer, snd_ak4117_timer, (unsigned long)chip);
chip->timer.data = (unsigned long)chip;
chip->timer.function = snd_ak4117_timer;
for (reg = 0; reg < 5; reg++) for (reg = 0; reg < 5; reg++)
chip->regmap[reg] = pgm[reg]; chip->regmap[reg] = pgm[reg];
...@@ -139,8 +137,7 @@ void snd_ak4117_reinit(struct ak4117 *chip) ...@@ -139,8 +137,7 @@ void snd_ak4117_reinit(struct ak4117 *chip)
/* release powerdown, everything is initialized now */ /* release powerdown, everything is initialized now */
reg_write(chip, AK4117_REG_PWRDN, old | AK4117_RST | AK4117_PWN); reg_write(chip, AK4117_REG_PWRDN, old | AK4117_RST | AK4117_PWN);
chip->init = 0; chip->init = 0;
chip->timer.expires = 1 + jiffies; mod_timer(&chip->timer, 1 + jiffies);
add_timer(&chip->timer);
} }
static unsigned int external_rate(unsigned char rcs1) static unsigned int external_rate(unsigned char rcs1)
...@@ -540,8 +537,7 @@ static void snd_ak4117_timer(unsigned long data) ...@@ -540,8 +537,7 @@ static void snd_ak4117_timer(unsigned long data)
if (chip->init) if (chip->init)
return; return;
snd_ak4117_check_rate_and_errors(chip, 0); snd_ak4117_check_rate_and_errors(chip, 0);
chip->timer.expires = 1 + jiffies; mod_timer(&chip->timer, 1 + jiffies);
add_timer(&chip->timer);
} }
EXPORT_SYMBOL(snd_ak4117_create); EXPORT_SYMBOL(snd_ak4117_create);
......
...@@ -207,8 +207,7 @@ static void emu8k_pcm_timer_func(unsigned long data) ...@@ -207,8 +207,7 @@ static void emu8k_pcm_timer_func(unsigned long data)
rec->last_ptr = ptr; rec->last_ptr = ptr;
/* reprogram timer */ /* reprogram timer */
rec->timer.expires = jiffies + 1; mod_timer(&rec->timer, jiffies + 1);
add_timer(&rec->timer);
/* update period */ /* update period */
if (rec->period_pos >= (int)rec->period_size) { if (rec->period_pos >= (int)rec->period_size) {
...@@ -240,9 +239,7 @@ static int emu8k_pcm_open(struct snd_pcm_substream *subs) ...@@ -240,9 +239,7 @@ static int emu8k_pcm_open(struct snd_pcm_substream *subs)
runtime->private_data = rec; runtime->private_data = rec;
spin_lock_init(&rec->timer_lock); spin_lock_init(&rec->timer_lock);
init_timer(&rec->timer); setup_timer(&rec->timer, emu8k_pcm_timer_func, (unsigned long)rec);
rec->timer.function = emu8k_pcm_timer_func;
rec->timer.data = (unsigned long)rec;
runtime->hw = emu8k_pcm_hw; runtime->hw = emu8k_pcm_hw;
runtime->hw.buffer_bytes_max = emu->mem_size - LOOP_BLANK_SIZE * 3; 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,8 +356,7 @@ static void start_voice(struct snd_emu8k_pcm *rec, int ch)
/* start timer */ /* start timer */
spin_lock_irqsave(&rec->timer_lock, flags); spin_lock_irqsave(&rec->timer_lock, flags);
if (! rec->timer_running) { if (! rec->timer_running) {
rec->timer.expires = jiffies + 1; mod_timer(&rec->timer, jiffies + 1);
add_timer(&rec->timer);
rec->timer_running = 1; rec->timer_running = 1;
} }
spin_unlock_irqrestore(&rec->timer_lock, flags); spin_unlock_irqrestore(&rec->timer_lock, flags);
......
...@@ -216,8 +216,7 @@ static void snd_sb8dsp_midi_output_timer(unsigned long data) ...@@ -216,8 +216,7 @@ static void snd_sb8dsp_midi_output_timer(unsigned long data)
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&chip->open_lock, flags); spin_lock_irqsave(&chip->open_lock, flags);
chip->midi_timer.expires = 1 + jiffies; mod_timer(&chip->midi_timer, 1 + jiffies);
add_timer(&chip->midi_timer);
spin_unlock_irqrestore(&chip->open_lock, flags); spin_unlock_irqrestore(&chip->open_lock, flags);
snd_sb8dsp_midi_output_write(substream); snd_sb8dsp_midi_output_write(substream);
} }
...@@ -231,11 +230,10 @@ static void snd_sb8dsp_midi_output_trigger(struct snd_rawmidi_substream *substre ...@@ -231,11 +230,10 @@ static void snd_sb8dsp_midi_output_trigger(struct snd_rawmidi_substream *substre
spin_lock_irqsave(&chip->open_lock, flags); spin_lock_irqsave(&chip->open_lock, flags);
if (up) { if (up) {
if (!(chip->open & SB_OPEN_MIDI_OUTPUT_TRIGGER)) { if (!(chip->open & SB_OPEN_MIDI_OUTPUT_TRIGGER)) {
init_timer(&chip->midi_timer); setup_timer(&chip->midi_timer,
chip->midi_timer.function = snd_sb8dsp_midi_output_timer; snd_sb8dsp_midi_output_timer,
chip->midi_timer.data = (unsigned long) substream; (unsigned long) substream);
chip->midi_timer.expires = 1 + jiffies; mod_timer(&chip->midi_timer, 1 + jiffies);
add_timer(&chip->midi_timer);
chip->open |= SB_OPEN_MIDI_OUTPUT_TRIGGER; chip->open |= SB_OPEN_MIDI_OUTPUT_TRIGGER;
} }
} else { } else {
......
...@@ -356,8 +356,7 @@ static void snd_wavefront_midi_output_timer(unsigned long data) ...@@ -356,8 +356,7 @@ static void snd_wavefront_midi_output_timer(unsigned long data)
unsigned long flags; unsigned long flags;
spin_lock_irqsave (&midi->virtual, flags); spin_lock_irqsave (&midi->virtual, flags);
midi->timer.expires = 1 + jiffies; mod_timer(&midi->timer, 1 + jiffies);
add_timer(&midi->timer);
spin_unlock_irqrestore (&midi->virtual, flags); spin_unlock_irqrestore (&midi->virtual, flags);
snd_wavefront_midi_output_write(card); snd_wavefront_midi_output_write(card);
} }
...@@ -384,11 +383,10 @@ static void snd_wavefront_midi_output_trigger(struct snd_rawmidi_substream *subs ...@@ -384,11 +383,10 @@ static void snd_wavefront_midi_output_trigger(struct snd_rawmidi_substream *subs
if (up) { if (up) {
if ((midi->mode[mpu] & MPU401_MODE_OUTPUT_TRIGGER) == 0) { if ((midi->mode[mpu] & MPU401_MODE_OUTPUT_TRIGGER) == 0) {
if (!midi->istimer) { if (!midi->istimer) {
init_timer(&midi->timer); setup_timer(&midi->timer,
midi->timer.function = snd_wavefront_midi_output_timer; snd_wavefront_midi_output_timer,
midi->timer.data = (unsigned long) substream->rmidi->card->private_data; (unsigned long) substream->rmidi->card->private_data);
midi->timer.expires = 1 + jiffies; mod_timer(&midi->timer, 1 + jiffies);
add_timer(&midi->timer);
} }
midi->istimer++; midi->istimer++;
midi->mode[mpu] |= MPU401_MODE_OUTPUT_TRIGGER; midi->mode[mpu] |= MPU401_MODE_OUTPUT_TRIGGER;
......
...@@ -540,9 +540,8 @@ static void snd_card_asihpi_pcm_timer_start(struct snd_pcm_substream * ...@@ -540,9 +540,8 @@ static void snd_card_asihpi_pcm_timer_start(struct snd_pcm_substream *
expiry = HZ / 200; expiry = HZ / 200;
expiry = max(expiry, 1); /* don't let it be zero! */ expiry = max(expiry, 1); /* don't let it be zero! */
dpcm->timer.expires = jiffies + expiry; mod_timer(&dpcm->timer, jiffies + expiry);
dpcm->respawn_timer = 1; dpcm->respawn_timer = 1;
add_timer(&dpcm->timer);
} }
static void snd_card_asihpi_pcm_timer_stop(struct snd_pcm_substream *substream) static void snd_card_asihpi_pcm_timer_stop(struct snd_pcm_substream *substream)
...@@ -1064,9 +1063,8 @@ static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream) ...@@ -1064,9 +1063,8 @@ static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream)
If internal and other stream playing, can't switch If internal and other stream playing, can't switch
*/ */
init_timer(&dpcm->timer); setup_timer(&dpcm->timer, snd_card_asihpi_timer_function,
dpcm->timer.data = (unsigned long) dpcm; (unsigned long) dpcm);
dpcm->timer.function = snd_card_asihpi_timer_function;
dpcm->substream = substream; dpcm->substream = substream;
runtime->private_data = dpcm; runtime->private_data = dpcm;
runtime->private_free = snd_card_asihpi_runtime_free; runtime->private_free = snd_card_asihpi_runtime_free;
...@@ -1246,9 +1244,8 @@ static int snd_card_asihpi_capture_open(struct snd_pcm_substream *substream) ...@@ -1246,9 +1244,8 @@ static int snd_card_asihpi_capture_open(struct snd_pcm_substream *substream)
if (err) if (err)
return -EIO; return -EIO;
init_timer(&dpcm->timer); setup_timer(&dpcm->timer, snd_card_asihpi_timer_function,
dpcm->timer.data = (unsigned long) dpcm; (unsigned long) dpcm);
dpcm->timer.function = snd_card_asihpi_timer_function;
dpcm->substream = substream; dpcm->substream = substream;
runtime->private_data = dpcm; runtime->private_data = dpcm;
runtime->private_free = snd_card_asihpi_runtime_free; runtime->private_free = snd_card_asihpi_runtime_free;
......
...@@ -257,9 +257,8 @@ static void snd_echo_midi_output_trigger(struct snd_rawmidi_substream *substream ...@@ -257,9 +257,8 @@ static void snd_echo_midi_output_trigger(struct snd_rawmidi_substream *substream
spin_lock_irq(&chip->lock); spin_lock_irq(&chip->lock);
if (up) { if (up) {
if (!chip->tinuse) { if (!chip->tinuse) {
init_timer(&chip->timer); setup_timer(&chip->timer, snd_echo_midi_output_write,
chip->timer.function = snd_echo_midi_output_write; (unsigned long)chip);
chip->timer.data = (unsigned long)chip;
chip->tinuse = 1; chip->tinuse = 1;
} }
} else { } else {
......
...@@ -585,8 +585,7 @@ static void snd_korg1212_SendStop(struct snd_korg1212 *korg1212) ...@@ -585,8 +585,7 @@ static void snd_korg1212_SendStop(struct snd_korg1212 *korg1212)
korg1212->sharedBufferPtr->cardCommand = 0xffffffff; korg1212->sharedBufferPtr->cardCommand = 0xffffffff;
/* program the timer */ /* program the timer */
korg1212->stop_pending_cnt = HZ; korg1212->stop_pending_cnt = HZ;
korg1212->timer.expires = jiffies + 1; mod_timer(&korg1212->timer, jiffies + 1);
add_timer(&korg1212->timer);
} }
} }
...@@ -617,8 +616,7 @@ static void snd_korg1212_timer_func(unsigned long data) ...@@ -617,8 +616,7 @@ static void snd_korg1212_timer_func(unsigned long data)
} else { } else {
if (--korg1212->stop_pending_cnt > 0) { if (--korg1212->stop_pending_cnt > 0) {
/* reprogram timer */ /* reprogram timer */
korg1212->timer.expires = jiffies + 1; mod_timer(&korg1212->timer, jiffies + 1);
add_timer(&korg1212->timer);
} else { } else {
snd_printd("korg1212_timer_func timeout\n"); snd_printd("korg1212_timer_func timeout\n");
korg1212->sharedBufferPtr->cardCommand = 0; korg1212->sharedBufferPtr->cardCommand = 0;
...@@ -2172,9 +2170,8 @@ static int snd_korg1212_create(struct snd_card *card, struct pci_dev *pci, ...@@ -2172,9 +2170,8 @@ static int snd_korg1212_create(struct snd_card *card, struct pci_dev *pci,
init_waitqueue_head(&korg1212->wait); init_waitqueue_head(&korg1212->wait);
spin_lock_init(&korg1212->lock); spin_lock_init(&korg1212->lock);
mutex_init(&korg1212->open_mutex); mutex_init(&korg1212->open_mutex);
init_timer(&korg1212->timer); setup_timer(&korg1212->timer, snd_korg1212_timer_func,
korg1212->timer.function = snd_korg1212_timer_func; (unsigned long)korg1212);
korg1212->timer.data = (unsigned long)korg1212;
korg1212->irq = -1; korg1212->irq = -1;
korg1212->clkSource = K1212_CLKIDX_Local; korg1212->clkSource = K1212_CLKIDX_Local;
......
...@@ -1428,10 +1428,8 @@ static void snd_hdsp_midi_output_timer(unsigned long data) ...@@ -1428,10 +1428,8 @@ static void snd_hdsp_midi_output_timer(unsigned long data)
leaving istimer wherever it was set before. leaving istimer wherever it was set before.
*/ */
if (hmidi->istimer) { if (hmidi->istimer)
hmidi->timer.expires = 1 + jiffies; mod_timer(&hmidi->timer, 1 + jiffies);
add_timer(&hmidi->timer);
}
spin_unlock_irqrestore (&hmidi->lock, flags); spin_unlock_irqrestore (&hmidi->lock, flags);
} }
...@@ -1445,11 +1443,9 @@ static void snd_hdsp_midi_output_trigger(struct snd_rawmidi_substream *substream ...@@ -1445,11 +1443,9 @@ static void snd_hdsp_midi_output_trigger(struct snd_rawmidi_substream *substream
spin_lock_irqsave (&hmidi->lock, flags); spin_lock_irqsave (&hmidi->lock, flags);
if (up) { if (up) {
if (!hmidi->istimer) { if (!hmidi->istimer) {
init_timer(&hmidi->timer); setup_timer(&hmidi->timer, snd_hdsp_midi_output_timer,
hmidi->timer.function = snd_hdsp_midi_output_timer; (unsigned long) hmidi);
hmidi->timer.data = (unsigned long) hmidi; mod_timer(&hmidi->timer, 1 + jiffies);
hmidi->timer.expires = 1 + jiffies;
add_timer(&hmidi->timer);
hmidi->istimer++; hmidi->istimer++;
} }
} else { } else {
......
...@@ -1957,10 +1957,8 @@ static void snd_hdspm_midi_output_timer(unsigned long data) ...@@ -1957,10 +1957,8 @@ static void snd_hdspm_midi_output_timer(unsigned long data)
leaving istimer wherever it was set before. leaving istimer wherever it was set before.
*/ */
if (hmidi->istimer) { if (hmidi->istimer)
hmidi->timer.expires = 1 + jiffies; mod_timer(&hmidi->timer, 1 + jiffies);
add_timer(&hmidi->timer);
}
spin_unlock_irqrestore (&hmidi->lock, flags); spin_unlock_irqrestore (&hmidi->lock, flags);
} }
...@@ -1975,11 +1973,9 @@ snd_hdspm_midi_output_trigger(struct snd_rawmidi_substream *substream, int up) ...@@ -1975,11 +1973,9 @@ snd_hdspm_midi_output_trigger(struct snd_rawmidi_substream *substream, int up)
spin_lock_irqsave (&hmidi->lock, flags); spin_lock_irqsave (&hmidi->lock, flags);
if (up) { if (up) {
if (!hmidi->istimer) { if (!hmidi->istimer) {
init_timer(&hmidi->timer); setup_timer(&hmidi->timer, snd_hdspm_midi_output_timer,
hmidi->timer.function = snd_hdspm_midi_output_timer; (unsigned long) hmidi);
hmidi->timer.data = (unsigned long) hmidi; mod_timer(&hmidi->timer, 1 + jiffies);
hmidi->timer.expires = 1 + jiffies;
add_timer(&hmidi->timer);
hmidi->istimer++; hmidi->istimer++;
} }
} else { } else {
......
...@@ -343,11 +343,9 @@ static void spu_begin_dma(struct snd_pcm_substream *substream) ...@@ -343,11 +343,9 @@ static void spu_begin_dma(struct snd_pcm_substream *substream)
mod_timer(&dreamcastcard->timer, jiffies + 4); mod_timer(&dreamcastcard->timer, jiffies + 4);
return; return;
} }
init_timer(&(dreamcastcard->timer)); setup_timer(&dreamcastcard->timer, aica_period_elapsed,
dreamcastcard->timer.data = (unsigned long) substream; (unsigned long) substream);
dreamcastcard->timer.function = aica_period_elapsed; mod_timer(&dreamcastcard->timer, jiffies + 4);
dreamcastcard->timer.expires = jiffies + 4;
add_timer(&(dreamcastcard->timer));
} }
static int snd_aicapcm_pcm_open(struct snd_pcm_substream static int snd_aicapcm_pcm_open(struct snd_pcm_substream
......
...@@ -53,9 +53,7 @@ int snd_emux_new(struct snd_emux **remu) ...@@ -53,9 +53,7 @@ int snd_emux_new(struct snd_emux **remu)
emu->max_voices = 0; emu->max_voices = 0;
emu->use_time = 0; emu->use_time = 0;
init_timer(&emu->tlist); setup_timer(&emu->tlist, snd_emux_timer_callback, (unsigned long)emu);
emu->tlist.function = snd_emux_timer_callback;
emu->tlist.data = (unsigned long)emu;
emu->timer_active = 0; emu->timer_active = 0;
*remu = emu; *remu = emu;
......
...@@ -186,8 +186,7 @@ snd_emux_note_off(void *p, int note, int vel, struct snd_midi_channel *chan) ...@@ -186,8 +186,7 @@ snd_emux_note_off(void *p, int note, int vel, struct snd_midi_channel *chan)
*/ */
vp->state = SNDRV_EMUX_ST_PENDING; vp->state = SNDRV_EMUX_ST_PENDING;
if (! emu->timer_active) { if (! emu->timer_active) {
emu->tlist.expires = jiffies + 1; mod_timer(&emu->tlist, jiffies + 1);
add_timer(&emu->tlist);
emu->timer_active = 1; emu->timer_active = 1;
} }
} else } else
...@@ -223,8 +222,7 @@ void snd_emux_timer_callback(unsigned long data) ...@@ -223,8 +222,7 @@ void snd_emux_timer_callback(unsigned long data)
} }
} }
if (do_again) { if (do_again) {
emu->tlist.expires = jiffies + 1; mod_timer(&emu->tlist, jiffies + 1);
add_timer(&emu->tlist);
emu->timer_active = 1; emu->timer_active = 1;
} else } else
emu->timer_active = 0; emu->timer_active = 0;
......
...@@ -2292,14 +2292,13 @@ int snd_usbmidi_create(struct snd_card *card, ...@@ -2292,14 +2292,13 @@ int snd_usbmidi_create(struct snd_card *card,
umidi->iface = iface; umidi->iface = iface;
umidi->quirk = quirk; umidi->quirk = quirk;
umidi->usb_protocol_ops = &snd_usbmidi_standard_ops; umidi->usb_protocol_ops = &snd_usbmidi_standard_ops;
init_timer(&umidi->error_timer);
spin_lock_init(&umidi->disc_lock); spin_lock_init(&umidi->disc_lock);
init_rwsem(&umidi->disc_rwsem); init_rwsem(&umidi->disc_rwsem);
mutex_init(&umidi->mutex); mutex_init(&umidi->mutex);
umidi->usb_id = USB_ID(le16_to_cpu(umidi->dev->descriptor.idVendor), umidi->usb_id = USB_ID(le16_to_cpu(umidi->dev->descriptor.idVendor),
le16_to_cpu(umidi->dev->descriptor.idProduct)); le16_to_cpu(umidi->dev->descriptor.idProduct));
umidi->error_timer.function = snd_usbmidi_error_timer; setup_timer(&umidi->error_timer, snd_usbmidi_error_timer,
umidi->error_timer.data = (unsigned long)umidi; (unsigned long)umidi);
/* detect the endpoint(s) to use */ /* detect the endpoint(s) to use */
memset(endpoints, 0, sizeof(endpoints)); memset(endpoints, 0, sizeof(endpoints));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment