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

This commit is contained in:
Takashi Iwai 2015-01-20 10:11:27 +01:00
Родитель 86b5f3ec41 28e237a9b7
Коммит 3b15d0d505
20 изменённых файлов: 63 добавлений и 114 удалений

Просмотреть файл

@ -1030,9 +1030,7 @@ static int snd_timer_register_system(void)
snd_timer_free(timer);
return -ENOMEM;
}
init_timer(&priv->tlist);
priv->tlist.function = snd_timer_s_function;
priv->tlist.data = (unsigned long) timer;
setup_timer(&priv->tlist, snd_timer_s_function, (unsigned long) timer);
timer->private_data = priv;
timer->private_free = snd_timer_free_system;
return snd_timer_global_register(timer);

Просмотреть файл

@ -181,8 +181,7 @@ static void loopback_timer_start(struct loopback_pcm *dpcm)
}
tick = dpcm->period_size_frac - dpcm->irq_pos;
tick = (tick + dpcm->pcm_bps - 1) / dpcm->pcm_bps;
dpcm->timer.expires = jiffies + tick;
add_timer(&dpcm->timer);
mod_timer(&dpcm->timer, jiffies + tick);
}
/* call in cable->lock */

Просмотреть файл

@ -176,8 +176,7 @@ static void snd_mpu401_uart_timer(unsigned long data)
spin_lock_irqsave(&mpu->timer_lock, flags);
/*mpu->mode |= MPU401_MODE_TIMER;*/
mpu->timer.expires = 1 + jiffies;
add_timer(&mpu->timer);
mod_timer(&mpu->timer, 1 + jiffies);
spin_unlock_irqrestore(&mpu->timer_lock, flags);
if (mpu->rmidi)
_snd_mpu401_uart_interrupt(mpu);
@ -192,11 +191,9 @@ static void snd_mpu401_uart_add_timer (struct snd_mpu401 *mpu, int input)
spin_lock_irqsave (&mpu->timer_lock, flags);
if (mpu->timer_invoked == 0) {
init_timer(&mpu->timer);
mpu->timer.data = (unsigned long)mpu;
mpu->timer.function = snd_mpu401_uart_timer;
mpu->timer.expires = 1 + jiffies;
add_timer(&mpu->timer);
setup_timer(&mpu->timer, snd_mpu401_uart_timer,
(unsigned long)mpu);
mod_timer(&mpu->timer, 1 + jiffies);
}
mpu->timer_invoked |= input ? MPU401_MODE_INPUT_TIMER :
MPU401_MODE_OUTPUT_TIMER;

Просмотреть файл

@ -414,8 +414,7 @@ static void snd_mtpav_output_timer(unsigned long data)
spin_lock_irqsave(&chip->spinlock, flags);
/* reprogram timer */
chip->timer.expires = 1 + jiffies;
add_timer(&chip->timer);
mod_timer(&chip->timer, 1 + jiffies);
/* process each port */
for (p = 0; p <= chip->num_ports * 2 + MTPAV_PIDX_BROADCAST; p++) {
struct mtpav_port *portp = &chip->ports[p];
@ -428,8 +427,7 @@ static void snd_mtpav_output_timer(unsigned long data)
/* spinlock held! */
static void snd_mtpav_add_output_timer(struct mtpav *chip)
{
chip->timer.expires = 1 + jiffies;
add_timer(&chip->timer);
mod_timer(&chip->timer, 1 + jiffies);
}
/* spinlock held! */
@ -704,15 +702,13 @@ static int snd_mtpav_probe(struct platform_device *dev)
mtp_card = card->private_data;
spin_lock_init(&mtp_card->spinlock);
init_timer(&mtp_card->timer);
mtp_card->card = card;
mtp_card->irq = -1;
mtp_card->share_irq = 0;
mtp_card->inmidistate = 0;
mtp_card->outmidihwport = 0xffffffff;
init_timer(&mtp_card->timer);
mtp_card->timer.function = snd_mtpav_output_timer;
mtp_card->timer.data = (unsigned long) mtp_card;
setup_timer(&mtp_card->timer, snd_mtpav_output_timer,
(unsigned long) mtp_card);
card->private_free = snd_mtpav_free;

Просмотреть файл

@ -258,12 +258,10 @@ void snd_opl3_timer_func(unsigned long data)
spin_unlock_irqrestore(&opl3->voice_lock, flags);
spin_lock_irqsave(&opl3->sys_timer_lock, flags);
if (again) {
opl3->tlist.expires = jiffies + 1; /* invoke again */
add_timer(&opl3->tlist);
} else {
if (again)
mod_timer(&opl3->tlist, jiffies + 1); /* invoke again */
else
opl3->sys_timer_status = 0;
}
spin_unlock_irqrestore(&opl3->sys_timer_lock, flags);
}
@ -275,8 +273,7 @@ static void snd_opl3_start_timer(struct snd_opl3 *opl3)
unsigned long flags;
spin_lock_irqsave(&opl3->sys_timer_lock, flags);
if (! opl3->sys_timer_status) {
opl3->tlist.expires = jiffies + 1;
add_timer(&opl3->tlist);
mod_timer(&opl3->tlist, jiffies + 1);
opl3->sys_timer_status = 1;
}
spin_unlock_irqrestore(&opl3->sys_timer_lock, flags);

Просмотреть файл

@ -247,9 +247,7 @@ static int snd_opl3_seq_new_device(struct snd_seq_device *dev)
}
/* setup system timer */
init_timer(&opl3->tlist);
opl3->tlist.function = snd_opl3_timer_func;
opl3->tlist.data = (unsigned long) opl3;
setup_timer(&opl3->tlist, snd_opl3_timer_func, (unsigned long) opl3);
spin_lock_init(&opl3->sys_timer_lock);
opl3->sys_timer_status = 0;

Просмотреть файл

@ -174,9 +174,8 @@ static inline void snd_uart16550_add_timer(struct snd_uart16550 *uart)
{
if (!uart->timer_running) {
/* 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;
add_timer(&uart->buffer_timer);
}
}
@ -830,9 +829,8 @@ static int snd_uart16550_create(struct snd_card *card,
uart->prev_in = 0;
uart->rstatus = 0;
memset(uart->prev_status, 0x80, sizeof(unsigned char) * SNDRV_SERIAL_MAX_OUTS);
init_timer(&uart->buffer_timer);
uart->buffer_timer.function = snd_uart16550_buffer_timer;
uart->buffer_timer.data = (unsigned long)uart;
setup_timer(&uart->buffer_timer, snd_uart16550_buffer_timer,
(unsigned long)uart);
uart->timer_running = 0;
/* Register device */

Просмотреть файл

@ -91,9 +91,7 @@ int snd_ak4117_create(struct snd_card *card, ak4117_read_t *read, ak4117_write_t
chip->read = read;
chip->write = write;
chip->private_data = private_data;
init_timer(&chip->timer);
chip->timer.data = (unsigned long)chip;
chip->timer.function = snd_ak4117_timer;
setup_timer(&chip->timer, snd_ak4117_timer, (unsigned long)chip);
for (reg = 0; reg < 5; reg++)
chip->regmap[reg] = pgm[reg];
@ -139,8 +137,7 @@ void snd_ak4117_reinit(struct ak4117 *chip)
/* release powerdown, everything is initialized now */
reg_write(chip, AK4117_REG_PWRDN, old | AK4117_RST | AK4117_PWN);
chip->init = 0;
chip->timer.expires = 1 + jiffies;
add_timer(&chip->timer);
mod_timer(&chip->timer, 1 + jiffies);
}
static unsigned int external_rate(unsigned char rcs1)
@ -540,8 +537,7 @@ static void snd_ak4117_timer(unsigned long data)
if (chip->init)
return;
snd_ak4117_check_rate_and_errors(chip, 0);
chip->timer.expires = 1 + jiffies;
add_timer(&chip->timer);
mod_timer(&chip->timer, 1 + jiffies);
}
EXPORT_SYMBOL(snd_ak4117_create);

Просмотреть файл

@ -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);

Просмотреть файл

@ -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 {

Просмотреть файл

@ -356,8 +356,7 @@ static void snd_wavefront_midi_output_timer(unsigned long data)
unsigned long flags;
spin_lock_irqsave (&midi->virtual, flags);
midi->timer.expires = 1 + jiffies;
add_timer(&midi->timer);
mod_timer(&midi->timer, 1 + jiffies);
spin_unlock_irqrestore (&midi->virtual, flags);
snd_wavefront_midi_output_write(card);
}
@ -384,11 +383,10 @@ static void snd_wavefront_midi_output_trigger(struct snd_rawmidi_substream *subs
if (up) {
if ((midi->mode[mpu] & MPU401_MODE_OUTPUT_TRIGGER) == 0) {
if (!midi->istimer) {
init_timer(&midi->timer);
midi->timer.function = snd_wavefront_midi_output_timer;
midi->timer.data = (unsigned long) substream->rmidi->card->private_data;
midi->timer.expires = 1 + jiffies;
add_timer(&midi->timer);
setup_timer(&midi->timer,
snd_wavefront_midi_output_timer,
(unsigned long) substream->rmidi->card->private_data);
mod_timer(&midi->timer, 1 + jiffies);
}
midi->istimer++;
midi->mode[mpu] |= MPU401_MODE_OUTPUT_TRIGGER;

Просмотреть файл

@ -540,9 +540,8 @@ static void snd_card_asihpi_pcm_timer_start(struct snd_pcm_substream *
expiry = HZ / 200;
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;
add_timer(&dpcm->timer);
}
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)
If internal and other stream playing, can't switch
*/
init_timer(&dpcm->timer);
dpcm->timer.data = (unsigned long) dpcm;
dpcm->timer.function = snd_card_asihpi_timer_function;
setup_timer(&dpcm->timer, snd_card_asihpi_timer_function,
(unsigned long) dpcm);
dpcm->substream = substream;
runtime->private_data = dpcm;
runtime->private_free = snd_card_asihpi_runtime_free;
@ -1246,9 +1244,8 @@ static int snd_card_asihpi_capture_open(struct snd_pcm_substream *substream)
if (err)
return -EIO;
init_timer(&dpcm->timer);
dpcm->timer.data = (unsigned long) dpcm;
dpcm->timer.function = snd_card_asihpi_timer_function;
setup_timer(&dpcm->timer, snd_card_asihpi_timer_function,
(unsigned long) dpcm);
dpcm->substream = substream;
runtime->private_data = dpcm;
runtime->private_free = snd_card_asihpi_runtime_free;

Просмотреть файл

@ -257,9 +257,8 @@ static void snd_echo_midi_output_trigger(struct snd_rawmidi_substream *substream
spin_lock_irq(&chip->lock);
if (up) {
if (!chip->tinuse) {
init_timer(&chip->timer);
chip->timer.function = snd_echo_midi_output_write;
chip->timer.data = (unsigned long)chip;
setup_timer(&chip->timer, snd_echo_midi_output_write,
(unsigned long)chip);
chip->tinuse = 1;
}
} else {

Просмотреть файл

@ -585,8 +585,7 @@ static void snd_korg1212_SendStop(struct snd_korg1212 *korg1212)
korg1212->sharedBufferPtr->cardCommand = 0xffffffff;
/* program the timer */
korg1212->stop_pending_cnt = HZ;
korg1212->timer.expires = jiffies + 1;
add_timer(&korg1212->timer);
mod_timer(&korg1212->timer, jiffies + 1);
}
}
@ -617,8 +616,7 @@ static void snd_korg1212_timer_func(unsigned long data)
} else {
if (--korg1212->stop_pending_cnt > 0) {
/* reprogram timer */
korg1212->timer.expires = jiffies + 1;
add_timer(&korg1212->timer);
mod_timer(&korg1212->timer, jiffies + 1);
} else {
snd_printd("korg1212_timer_func timeout\n");
korg1212->sharedBufferPtr->cardCommand = 0;
@ -2172,9 +2170,8 @@ static int snd_korg1212_create(struct snd_card *card, struct pci_dev *pci,
init_waitqueue_head(&korg1212->wait);
spin_lock_init(&korg1212->lock);
mutex_init(&korg1212->open_mutex);
init_timer(&korg1212->timer);
korg1212->timer.function = snd_korg1212_timer_func;
korg1212->timer.data = (unsigned long)korg1212;
setup_timer(&korg1212->timer, snd_korg1212_timer_func,
(unsigned long)korg1212);
korg1212->irq = -1;
korg1212->clkSource = K1212_CLKIDX_Local;

Просмотреть файл

@ -1428,10 +1428,8 @@ static void snd_hdsp_midi_output_timer(unsigned long data)
leaving istimer wherever it was set before.
*/
if (hmidi->istimer) {
hmidi->timer.expires = 1 + jiffies;
add_timer(&hmidi->timer);
}
if (hmidi->istimer)
mod_timer(&hmidi->timer, 1 + jiffies);
spin_unlock_irqrestore (&hmidi->lock, flags);
}
@ -1445,11 +1443,9 @@ static void snd_hdsp_midi_output_trigger(struct snd_rawmidi_substream *substream
spin_lock_irqsave (&hmidi->lock, flags);
if (up) {
if (!hmidi->istimer) {
init_timer(&hmidi->timer);
hmidi->timer.function = snd_hdsp_midi_output_timer;
hmidi->timer.data = (unsigned long) hmidi;
hmidi->timer.expires = 1 + jiffies;
add_timer(&hmidi->timer);
setup_timer(&hmidi->timer, snd_hdsp_midi_output_timer,
(unsigned long) hmidi);
mod_timer(&hmidi->timer, 1 + jiffies);
hmidi->istimer++;
}
} else {

Просмотреть файл

@ -1957,10 +1957,8 @@ static void snd_hdspm_midi_output_timer(unsigned long data)
leaving istimer wherever it was set before.
*/
if (hmidi->istimer) {
hmidi->timer.expires = 1 + jiffies;
add_timer(&hmidi->timer);
}
if (hmidi->istimer)
mod_timer(&hmidi->timer, 1 + jiffies);
spin_unlock_irqrestore (&hmidi->lock, flags);
}
@ -1975,11 +1973,9 @@ snd_hdspm_midi_output_trigger(struct snd_rawmidi_substream *substream, int up)
spin_lock_irqsave (&hmidi->lock, flags);
if (up) {
if (!hmidi->istimer) {
init_timer(&hmidi->timer);
hmidi->timer.function = snd_hdspm_midi_output_timer;
hmidi->timer.data = (unsigned long) hmidi;
hmidi->timer.expires = 1 + jiffies;
add_timer(&hmidi->timer);
setup_timer(&hmidi->timer, snd_hdspm_midi_output_timer,
(unsigned long) hmidi);
mod_timer(&hmidi->timer, 1 + jiffies);
hmidi->istimer++;
}
} else {

Просмотреть файл

@ -343,11 +343,9 @@ static void spu_begin_dma(struct snd_pcm_substream *substream)
mod_timer(&dreamcastcard->timer, jiffies + 4);
return;
}
init_timer(&(dreamcastcard->timer));
dreamcastcard->timer.data = (unsigned long) substream;
dreamcastcard->timer.function = aica_period_elapsed;
dreamcastcard->timer.expires = jiffies + 4;
add_timer(&(dreamcastcard->timer));
setup_timer(&dreamcastcard->timer, aica_period_elapsed,
(unsigned long) substream);
mod_timer(&dreamcastcard->timer, jiffies + 4);
}
static int snd_aicapcm_pcm_open(struct snd_pcm_substream

Просмотреть файл

@ -53,9 +53,7 @@ int snd_emux_new(struct snd_emux **remu)
emu->max_voices = 0;
emu->use_time = 0;
init_timer(&emu->tlist);
emu->tlist.function = snd_emux_timer_callback;
emu->tlist.data = (unsigned long)emu;
setup_timer(&emu->tlist, snd_emux_timer_callback, (unsigned long)emu);
emu->timer_active = 0;
*remu = emu;

Просмотреть файл

@ -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;
if (! emu->timer_active) {
emu->tlist.expires = jiffies + 1;
add_timer(&emu->tlist);
mod_timer(&emu->tlist, jiffies + 1);
emu->timer_active = 1;
}
} else
@ -223,8 +222,7 @@ void snd_emux_timer_callback(unsigned long data)
}
}
if (do_again) {
emu->tlist.expires = jiffies + 1;
add_timer(&emu->tlist);
mod_timer(&emu->tlist, jiffies + 1);
emu->timer_active = 1;
} else
emu->timer_active = 0;

Просмотреть файл

@ -2292,14 +2292,13 @@ int snd_usbmidi_create(struct snd_card *card,
umidi->iface = iface;
umidi->quirk = quirk;
umidi->usb_protocol_ops = &snd_usbmidi_standard_ops;
init_timer(&umidi->error_timer);
spin_lock_init(&umidi->disc_lock);
init_rwsem(&umidi->disc_rwsem);
mutex_init(&umidi->mutex);
umidi->usb_id = USB_ID(le16_to_cpu(umidi->dev->descriptor.idVendor),
le16_to_cpu(umidi->dev->descriptor.idProduct));
umidi->error_timer.function = snd_usbmidi_error_timer;
umidi->error_timer.data = (unsigned long)umidi;
setup_timer(&umidi->error_timer, snd_usbmidi_error_timer,
(unsigned long)umidi);
/* detect the endpoint(s) to use */
memset(endpoints, 0, sizeof(endpoints));