Commit 7211ec63 authored by Kees Cook's avatar Kees Cook Committed by Takashi Iwai

ALSA: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list
pointer to all timer callbacks, switch to using the new timer_setup()
and from_timer() to pass the timer pointer explicitly. These are all the
"mechanical" changes remaining in the sound subsystem.
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Acked-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 20e5f8bf
......@@ -35,7 +35,7 @@ MODULE_LICENSE("GPL");
#define AK4117_ADDR 0x00 /* fixed address */
static void snd_ak4117_timer(unsigned long data);
static void snd_ak4117_timer(struct timer_list *t);
static void reg_write(struct ak4117 *ak4117, unsigned char reg, unsigned char val)
{
......@@ -91,7 +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;
setup_timer(&chip->timer, snd_ak4117_timer, (unsigned long)chip);
timer_setup(&chip->timer, snd_ak4117_timer, 0);
for (reg = 0; reg < 5; reg++)
chip->regmap[reg] = pgm[reg];
......@@ -529,9 +529,9 @@ int snd_ak4117_check_rate_and_errors(struct ak4117 *ak4117, unsigned int flags)
return res;
}
static void snd_ak4117_timer(unsigned long data)
static void snd_ak4117_timer(struct timer_list *t)
{
struct ak4117 *chip = (struct ak4117 *)data;
struct ak4117 *chip = from_timer(chip, t, timer);
if (chip->init)
return;
......
......@@ -63,9 +63,9 @@ struct ct_timer {
* system-timer-based updates
*/
static void ct_systimer_callback(unsigned long data)
static void ct_systimer_callback(struct timer_list *t)
{
struct ct_timer_instance *ti = (struct ct_timer_instance *)data;
struct ct_timer_instance *ti = from_timer(ti, t, timer);
struct snd_pcm_substream *substream = ti->substream;
struct snd_pcm_runtime *runtime = substream->runtime;
struct ct_atc_pcm *apcm = ti->apcm;
......@@ -93,8 +93,7 @@ static void ct_systimer_callback(unsigned long data)
static void ct_systimer_init(struct ct_timer_instance *ti)
{
setup_timer(&ti->timer, ct_systimer_callback,
(unsigned long)ti);
timer_setup(&ti->timer, ct_systimer_callback, 0);
}
static void ct_systimer_start(struct ct_timer_instance *ti)
......
......@@ -199,9 +199,9 @@ static int snd_echo_midi_output_open(struct snd_rawmidi_substream *substream)
static void snd_echo_midi_output_write(unsigned long data)
static void snd_echo_midi_output_write(struct timer_list *t)
{
struct echoaudio *chip = (struct echoaudio *)data;
struct echoaudio *chip = from_timer(chip, t, timer);
unsigned long flags;
int bytes, sent, time;
unsigned char buf[MIDI_OUT_BUFFER_SIZE - 1];
......@@ -257,8 +257,8 @@ static void snd_echo_midi_output_trigger(struct snd_rawmidi_substream *substream
spin_lock_irq(&chip->lock);
if (up) {
if (!chip->tinuse) {
setup_timer(&chip->timer, snd_echo_midi_output_write,
(unsigned long)chip);
timer_setup(&chip->timer, snd_echo_midi_output_write,
0);
chip->tinuse = 1;
}
} else {
......@@ -273,7 +273,7 @@ static void snd_echo_midi_output_trigger(struct snd_rawmidi_substream *substream
spin_unlock_irq(&chip->lock);
if (up && !chip->midi_full)
snd_echo_midi_output_write((unsigned long)chip);
snd_echo_midi_output_write(&chip->timer);
}
......
......@@ -599,9 +599,9 @@ static void snd_korg1212_SendStopAndWait(struct snd_korg1212 *korg1212)
}
/* timer callback for checking the ack of stop request */
static void snd_korg1212_timer_func(unsigned long data)
static void snd_korg1212_timer_func(struct timer_list *t)
{
struct snd_korg1212 *korg1212 = (struct snd_korg1212 *) data;
struct snd_korg1212 *korg1212 = from_timer(korg1212, t, timer);
unsigned long flags;
spin_lock_irqsave(&korg1212->lock, flags);
......@@ -2189,8 +2189,7 @@ 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);
setup_timer(&korg1212->timer, snd_korg1212_timer_func,
(unsigned long)korg1212);
timer_setup(&korg1212->timer, snd_korg1212_timer_func, 0);
korg1212->irq = -1;
korg1212->clkSource = K1212_CLKIDX_Local;
......
......@@ -1410,9 +1410,9 @@ static void snd_hdsp_midi_input_trigger(struct snd_rawmidi_substream *substream,
spin_unlock_irqrestore (&hdsp->lock, flags);
}
static void snd_hdsp_midi_output_timer(unsigned long data)
static void snd_hdsp_midi_output_timer(struct timer_list *t)
{
struct hdsp_midi *hmidi = (struct hdsp_midi *) data;
struct hdsp_midi *hmidi = from_timer(hmidi, t, timer);
unsigned long flags;
snd_hdsp_midi_output_write(hmidi);
......@@ -1439,8 +1439,8 @@ static void snd_hdsp_midi_output_trigger(struct snd_rawmidi_substream *substream
spin_lock_irqsave (&hmidi->lock, flags);
if (up) {
if (!hmidi->istimer) {
setup_timer(&hmidi->timer, snd_hdsp_midi_output_timer,
(unsigned long) hmidi);
timer_setup(&hmidi->timer, snd_hdsp_midi_output_timer,
0);
mod_timer(&hmidi->timer, 1 + jiffies);
hmidi->istimer++;
}
......
......@@ -1946,9 +1946,9 @@ snd_hdspm_midi_input_trigger(struct snd_rawmidi_substream *substream, int up)
spin_unlock_irqrestore (&hdspm->lock, flags);
}
static void snd_hdspm_midi_output_timer(unsigned long data)
static void snd_hdspm_midi_output_timer(struct timer_list *t)
{
struct hdspm_midi *hmidi = (struct hdspm_midi *) data;
struct hdspm_midi *hmidi = from_timer(hmidi, t, timer);
unsigned long flags;
snd_hdspm_midi_output_write(hmidi);
......@@ -1976,8 +1976,8 @@ snd_hdspm_midi_output_trigger(struct snd_rawmidi_substream *substream, int up)
spin_lock_irqsave (&hmidi->lock, flags);
if (up) {
if (!hmidi->istimer) {
setup_timer(&hmidi->timer, snd_hdspm_midi_output_timer,
(unsigned long) hmidi);
timer_setup(&hmidi->timer,
snd_hdspm_midi_output_timer, 0);
mod_timer(&hmidi->timer, 1 + jiffies);
hmidi->istimer++;
}
......
......@@ -3340,9 +3340,9 @@ static irqreturn_t rt5645_irq(int irq, void *data)
return IRQ_HANDLED;
}
static void rt5645_btn_check_callback(unsigned long data)
static void rt5645_btn_check_callback(struct timer_list *t)
{
struct rt5645_priv *rt5645 = (struct rt5645_priv *)data;
struct rt5645_priv *rt5645 = from_timer(rt5645, t, btn_check_timer);
queue_delayed_work(system_power_efficient_wq,
&rt5645->jack_detect_work, msecs_to_jiffies(5));
......@@ -3934,8 +3934,7 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
regmap_update_bits(rt5645->regmap, RT5645_IRQ_CTRL2,
RT5645_JD_1_1_MASK, RT5645_JD_1_1_INV);
}
setup_timer(&rt5645->btn_check_timer,
rt5645_btn_check_callback, (unsigned long)rt5645);
timer_setup(&rt5645->btn_check_timer, rt5645_btn_check_callback, 0);
INIT_DELAYED_WORK(&rt5645->jack_detect_work, rt5645_jack_detect_work);
INIT_DELAYED_WORK(&rt5645->rcclock_work, rt5645_rcclock_work);
......
......@@ -260,7 +260,7 @@ static bool cx81801_cmd_pending;
static bool ams_delta_muted;
static DEFINE_SPINLOCK(ams_delta_lock);
static void cx81801_timeout(unsigned long data)
static void cx81801_timeout(struct timer_list *unused)
{
int muted;
......@@ -349,7 +349,7 @@ static void cx81801_receive(struct tty_struct *tty,
/* First modem response, complete setup procedure */
/* Initialize timer used for config pulse generation */
setup_timer(&cx81801_timer, cx81801_timeout, 0);
timer_setup(&cx81801_timer, cx81801_timeout, 0);
v253_ops.receive_buf(tty, cp, fp, count);
......
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