[alsa-devel] [PATCH 00/18] Use setup_timer() and mod_timer()
Hi,
this is a series of simple cleanup patches to replace the open codes with the standard helpers, setup_timer() and mod_timer().
Takashi
No functional change, refactoring with the standard helpers.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/core/timer.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/sound/core/timer.c b/sound/core/timer.c index 777a45e08e53..a44235555896 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -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);
No functional change, refactoring with the standard helpers.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/drivers/aloop.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c index 7ea53399404d..7f9126efc1e5 100644 --- a/sound/drivers/aloop.c +++ b/sound/drivers/aloop.c @@ -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 */
No functional change, refactoring with the standard helpers.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/drivers/mpu401/mpu401_uart.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/sound/drivers/mpu401/mpu401_uart.c b/sound/drivers/mpu401/mpu401_uart.c index e3a90d043f03..1e19eb9e1596 100644 --- a/sound/drivers/mpu401/mpu401_uart.c +++ b/sound/drivers/mpu401/mpu401_uart.c @@ -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;
No functional change, refactoring with the standard helpers.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/drivers/mtpav.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/sound/drivers/mtpav.c b/sound/drivers/mtpav.c index 15769447688f..30e8a1d5bc87 100644 --- a/sound/drivers/mtpav.c +++ b/sound/drivers/mtpav.c @@ -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;
No functional change, refactoring with the standard helpers.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/drivers/opl3/opl3_midi.c | 11 ++++------- sound/drivers/opl3/opl3_seq.c | 4 +--- 2 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/sound/drivers/opl3/opl3_midi.c b/sound/drivers/opl3/opl3_midi.c index 6c6d09a51f42..f62780ed64ad 100644 --- a/sound/drivers/opl3/opl3_midi.c +++ b/sound/drivers/opl3/opl3_midi.c @@ -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); diff --git a/sound/drivers/opl3/opl3_seq.c b/sound/drivers/opl3/opl3_seq.c index 68399538e435..a9f618e06a22 100644 --- a/sound/drivers/opl3/opl3_seq.c +++ b/sound/drivers/opl3/opl3_seq.c @@ -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;
No functional change, refactoring with the standard helpers.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/drivers/serial-u16550.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c index 13a34e3c6382..8c1dc73e14e4 100644 --- a/sound/drivers/serial-u16550.c +++ b/sound/drivers/serial-u16550.c @@ -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 */
No functional change, refactoring with the standard helpers.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/i2c/other/ak4117.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/sound/i2c/other/ak4117.c b/sound/i2c/other/ak4117.c index 88452e899bd9..48848909a5a9 100644 --- a/sound/i2c/other/ak4117.c +++ b/sound/i2c/other/ak4117.c @@ -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);
No functional change, refactoring with the standard helpers.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/isa/sb/emu8000_pcm.c | 10 +++------- sound/isa/sb/sb8_midi.c | 12 +++++------- 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) 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); 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) 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 {
No functional change, refactoring with the standard helpers.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/isa/wavefront/wavefront_midi.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/sound/isa/wavefront/wavefront_midi.c b/sound/isa/wavefront/wavefront_midi.c index 7dc991682297..b8009cbcd34e 100644 --- a/sound/isa/wavefront/wavefront_midi.c +++ b/sound/isa/wavefront/wavefront_midi.c @@ -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;
No functional change, refactoring with the standard helpers.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/asihpi/asihpi.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index 7a55fefed5c4..e5cd7be85355 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c @@ -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;
No functional change, refactoring with the standard helpers.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/echoaudio/midi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/sound/pci/echoaudio/midi.c b/sound/pci/echoaudio/midi.c index d913749d154a..a8fe58335ddc 100644 --- a/sound/pci/echoaudio/midi.c +++ b/sound/pci/echoaudio/midi.c @@ -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 {
No functional change, refactoring with the standard helpers.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/korg1212/korg1212.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c index 59d21c9401d2..bd569e580277 100644 --- a/sound/pci/korg1212/korg1212.c +++ b/sound/pci/korg1212/korg1212.c @@ -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;
No functional change, refactoring with the standard helpers.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/rme9652/hdsp.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index fe66bcb21475..98a2d911ef17 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c @@ -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 {
No functional change, refactoring with the standard helpers.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/rme9652/hdspm.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 8109b8e5f6ef..1716323fed9c 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -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 {
No functional change, refactoring with the standard helpers.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/sh/aica.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/sound/sh/aica.c b/sound/sh/aica.c index f44dda610ed2..8212300088fc 100644 --- a/sound/sh/aica.c +++ b/sound/sh/aica.c @@ -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
No functional change, refactoring with the standard helpers.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/synth/emux/emux.c | 4 +--- sound/synth/emux/emux_synth.c | 6 ++---- 2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/sound/synth/emux/emux.c b/sound/synth/emux/emux.c index f27a1c85f81b..49195325fdf6 100644 --- a/sound/synth/emux/emux.c +++ b/sound/synth/emux/emux.c @@ -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; diff --git a/sound/synth/emux/emux_synth.c b/sound/synth/emux/emux_synth.c index 9a38de459acb..599551b5af44 100644 --- a/sound/synth/emux/emux_synth.c +++ b/sound/synth/emux/emux_synth.c @@ -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;
No functional change, refactoring with the standard helpers.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/usb/midi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/sound/usb/midi.c b/sound/usb/midi.c index 5bfb695547f8..417ebb11cf48 100644 --- a/sound/usb/midi.c +++ b/sound/usb/midi.c @@ -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));
No functional change, refactoring with the standard helpers.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/usb/line6/driver.c | 3 +-- sound/usb/line6/toneport.c | 8 +++----- 2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c index fc852f6ab8bc..19904d677114 100644 --- a/sound/usb/line6/driver.c +++ b/sound/usb/line6/driver.c @@ -415,8 +415,7 @@ void line6_start_timer(struct timer_list *timer, unsigned int msecs, void (*function)(unsigned long), unsigned long data) { setup_timer(timer, function, data); - timer->expires = jiffies + msecs * HZ / 1000; - add_timer(timer); + mod_timer(timer, jiffies + msecs * HZ / 1000); }
/* diff --git a/sound/usb/line6/toneport.c b/sound/usb/line6/toneport.c index aae78d8a82d9..7f97f4a812a7 100644 --- a/sound/usb/line6/toneport.c +++ b/sound/usb/line6/toneport.c @@ -433,11 +433,9 @@ static int toneport_try_init(struct usb_interface *interface,
toneport_setup(toneport);
- init_timer(&toneport->timer); - toneport->timer.expires = jiffies + TONEPORT_PCM_DELAY * HZ; - toneport->timer.function = toneport_start_pcm; - toneport->timer.data = (unsigned long)toneport; - add_timer(&toneport->timer); + setup_timer(&toneport->timer, toneport_start_pcm, + (unsigned long)toneport); + mod_timer(&toneport->timer, jiffies + TONEPORT_PCM_DELAY * HZ);
return 0; }
participants (1)
-
Takashi Iwai