diff options
author | Kees Cook <keescook@chromium.org> | 2017-10-25 11:09:27 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2017-10-26 08:44:59 -0400 |
commit | 7211ec6392c8650ebc804023178c245464417ed2 (patch) | |
tree | e94c80c2618a50be61994b55372390484dcff456 | |
parent | 20e5f8bfb153bdd43b5be194658f8ad814470a5d (diff) |
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: Kees Cook <keescook@chromium.org>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/i2c/other/ak4117.c | 8 | ||||
-rw-r--r-- | sound/pci/ctxfi/cttimer.c | 7 | ||||
-rw-r--r-- | sound/pci/echoaudio/midi.c | 10 | ||||
-rw-r--r-- | sound/pci/korg1212/korg1212.c | 7 | ||||
-rw-r--r-- | sound/pci/rme9652/hdsp.c | 8 | ||||
-rw-r--r-- | sound/pci/rme9652/hdspm.c | 8 | ||||
-rw-r--r-- | sound/soc/codecs/rt5645.c | 7 | ||||
-rw-r--r-- | sound/soc/omap/ams-delta.c | 4 |
8 files changed, 28 insertions, 31 deletions
diff --git a/sound/i2c/other/ak4117.c b/sound/i2c/other/ak4117.c index 3ab099fb8c15..b923342cadf4 100644 --- a/sound/i2c/other/ak4117.c +++ b/sound/i2c/other/ak4117.c | |||
@@ -35,7 +35,7 @@ MODULE_LICENSE("GPL"); | |||
35 | 35 | ||
36 | #define AK4117_ADDR 0x00 /* fixed address */ | 36 | #define AK4117_ADDR 0x00 /* fixed address */ |
37 | 37 | ||
38 | static void snd_ak4117_timer(unsigned long data); | 38 | static void snd_ak4117_timer(struct timer_list *t); |
39 | 39 | ||
40 | static void reg_write(struct ak4117 *ak4117, unsigned char reg, unsigned char val) | 40 | static void reg_write(struct ak4117 *ak4117, unsigned char reg, unsigned char val) |
41 | { | 41 | { |
@@ -91,7 +91,7 @@ int snd_ak4117_create(struct snd_card *card, ak4117_read_t *read, ak4117_write_t | |||
91 | chip->read = read; | 91 | chip->read = read; |
92 | chip->write = write; | 92 | chip->write = write; |
93 | chip->private_data = private_data; | 93 | chip->private_data = private_data; |
94 | setup_timer(&chip->timer, snd_ak4117_timer, (unsigned long)chip); | 94 | timer_setup(&chip->timer, snd_ak4117_timer, 0); |
95 | 95 | ||
96 | for (reg = 0; reg < 5; reg++) | 96 | for (reg = 0; reg < 5; reg++) |
97 | chip->regmap[reg] = pgm[reg]; | 97 | chip->regmap[reg] = pgm[reg]; |
@@ -529,9 +529,9 @@ int snd_ak4117_check_rate_and_errors(struct ak4117 *ak4117, unsigned int flags) | |||
529 | return res; | 529 | return res; |
530 | } | 530 | } |
531 | 531 | ||
532 | static void snd_ak4117_timer(unsigned long data) | 532 | static void snd_ak4117_timer(struct timer_list *t) |
533 | { | 533 | { |
534 | struct ak4117 *chip = (struct ak4117 *)data; | 534 | struct ak4117 *chip = from_timer(chip, t, timer); |
535 | 535 | ||
536 | if (chip->init) | 536 | if (chip->init) |
537 | return; | 537 | return; |
diff --git a/sound/pci/ctxfi/cttimer.c b/sound/pci/ctxfi/cttimer.c index 8f945341720b..08e874e9a7f6 100644 --- a/sound/pci/ctxfi/cttimer.c +++ b/sound/pci/ctxfi/cttimer.c | |||
@@ -63,9 +63,9 @@ struct ct_timer { | |||
63 | * system-timer-based updates | 63 | * system-timer-based updates |
64 | */ | 64 | */ |
65 | 65 | ||
66 | static void ct_systimer_callback(unsigned long data) | 66 | static void ct_systimer_callback(struct timer_list *t) |
67 | { | 67 | { |
68 | struct ct_timer_instance *ti = (struct ct_timer_instance *)data; | 68 | struct ct_timer_instance *ti = from_timer(ti, t, timer); |
69 | struct snd_pcm_substream *substream = ti->substream; | 69 | struct snd_pcm_substream *substream = ti->substream; |
70 | struct snd_pcm_runtime *runtime = substream->runtime; | 70 | struct snd_pcm_runtime *runtime = substream->runtime; |
71 | struct ct_atc_pcm *apcm = ti->apcm; | 71 | struct ct_atc_pcm *apcm = ti->apcm; |
@@ -93,8 +93,7 @@ static void ct_systimer_callback(unsigned long data) | |||
93 | 93 | ||
94 | static void ct_systimer_init(struct ct_timer_instance *ti) | 94 | static void ct_systimer_init(struct ct_timer_instance *ti) |
95 | { | 95 | { |
96 | setup_timer(&ti->timer, ct_systimer_callback, | 96 | timer_setup(&ti->timer, ct_systimer_callback, 0); |
97 | (unsigned long)ti); | ||
98 | } | 97 | } |
99 | 98 | ||
100 | static void ct_systimer_start(struct ct_timer_instance *ti) | 99 | static void ct_systimer_start(struct ct_timer_instance *ti) |
diff --git a/sound/pci/echoaudio/midi.c b/sound/pci/echoaudio/midi.c index 8c685ddb1a41..6045a115cffe 100644 --- a/sound/pci/echoaudio/midi.c +++ b/sound/pci/echoaudio/midi.c | |||
@@ -199,9 +199,9 @@ static int snd_echo_midi_output_open(struct snd_rawmidi_substream *substream) | |||
199 | 199 | ||
200 | 200 | ||
201 | 201 | ||
202 | static void snd_echo_midi_output_write(unsigned long data) | 202 | static void snd_echo_midi_output_write(struct timer_list *t) |
203 | { | 203 | { |
204 | struct echoaudio *chip = (struct echoaudio *)data; | 204 | struct echoaudio *chip = from_timer(chip, t, timer); |
205 | unsigned long flags; | 205 | unsigned long flags; |
206 | int bytes, sent, time; | 206 | int bytes, sent, time; |
207 | unsigned char buf[MIDI_OUT_BUFFER_SIZE - 1]; | 207 | unsigned char buf[MIDI_OUT_BUFFER_SIZE - 1]; |
@@ -257,8 +257,8 @@ static void snd_echo_midi_output_trigger(struct snd_rawmidi_substream *substream | |||
257 | spin_lock_irq(&chip->lock); | 257 | spin_lock_irq(&chip->lock); |
258 | if (up) { | 258 | if (up) { |
259 | if (!chip->tinuse) { | 259 | if (!chip->tinuse) { |
260 | setup_timer(&chip->timer, snd_echo_midi_output_write, | 260 | timer_setup(&chip->timer, snd_echo_midi_output_write, |
261 | (unsigned long)chip); | 261 | 0); |
262 | chip->tinuse = 1; | 262 | chip->tinuse = 1; |
263 | } | 263 | } |
264 | } else { | 264 | } else { |
@@ -273,7 +273,7 @@ static void snd_echo_midi_output_trigger(struct snd_rawmidi_substream *substream | |||
273 | spin_unlock_irq(&chip->lock); | 273 | spin_unlock_irq(&chip->lock); |
274 | 274 | ||
275 | if (up && !chip->midi_full) | 275 | if (up && !chip->midi_full) |
276 | snd_echo_midi_output_write((unsigned long)chip); | 276 | snd_echo_midi_output_write(&chip->timer); |
277 | } | 277 | } |
278 | 278 | ||
279 | 279 | ||
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c index 04cd71c74e5c..c7b007164c99 100644 --- a/sound/pci/korg1212/korg1212.c +++ b/sound/pci/korg1212/korg1212.c | |||
@@ -599,9 +599,9 @@ static void snd_korg1212_SendStopAndWait(struct snd_korg1212 *korg1212) | |||
599 | } | 599 | } |
600 | 600 | ||
601 | /* timer callback for checking the ack of stop request */ | 601 | /* timer callback for checking the ack of stop request */ |
602 | static void snd_korg1212_timer_func(unsigned long data) | 602 | static void snd_korg1212_timer_func(struct timer_list *t) |
603 | { | 603 | { |
604 | struct snd_korg1212 *korg1212 = (struct snd_korg1212 *) data; | 604 | struct snd_korg1212 *korg1212 = from_timer(korg1212, t, timer); |
605 | unsigned long flags; | 605 | unsigned long flags; |
606 | 606 | ||
607 | spin_lock_irqsave(&korg1212->lock, flags); | 607 | spin_lock_irqsave(&korg1212->lock, flags); |
@@ -2189,8 +2189,7 @@ static int snd_korg1212_create(struct snd_card *card, struct pci_dev *pci, | |||
2189 | init_waitqueue_head(&korg1212->wait); | 2189 | init_waitqueue_head(&korg1212->wait); |
2190 | spin_lock_init(&korg1212->lock); | 2190 | spin_lock_init(&korg1212->lock); |
2191 | mutex_init(&korg1212->open_mutex); | 2191 | mutex_init(&korg1212->open_mutex); |
2192 | setup_timer(&korg1212->timer, snd_korg1212_timer_func, | 2192 | timer_setup(&korg1212->timer, snd_korg1212_timer_func, 0); |
2193 | (unsigned long)korg1212); | ||
2194 | 2193 | ||
2195 | korg1212->irq = -1; | 2194 | korg1212->irq = -1; |
2196 | korg1212->clkSource = K1212_CLKIDX_Local; | 2195 | korg1212->clkSource = K1212_CLKIDX_Local; |
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index 9f0f73875f01..1bff4b1b39cd 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c | |||
@@ -1410,9 +1410,9 @@ static void snd_hdsp_midi_input_trigger(struct snd_rawmidi_substream *substream, | |||
1410 | spin_unlock_irqrestore (&hdsp->lock, flags); | 1410 | spin_unlock_irqrestore (&hdsp->lock, flags); |
1411 | } | 1411 | } |
1412 | 1412 | ||
1413 | static void snd_hdsp_midi_output_timer(unsigned long data) | 1413 | static void snd_hdsp_midi_output_timer(struct timer_list *t) |
1414 | { | 1414 | { |
1415 | struct hdsp_midi *hmidi = (struct hdsp_midi *) data; | 1415 | struct hdsp_midi *hmidi = from_timer(hmidi, t, timer); |
1416 | unsigned long flags; | 1416 | unsigned long flags; |
1417 | 1417 | ||
1418 | snd_hdsp_midi_output_write(hmidi); | 1418 | snd_hdsp_midi_output_write(hmidi); |
@@ -1439,8 +1439,8 @@ static void snd_hdsp_midi_output_trigger(struct snd_rawmidi_substream *substream | |||
1439 | spin_lock_irqsave (&hmidi->lock, flags); | 1439 | spin_lock_irqsave (&hmidi->lock, flags); |
1440 | if (up) { | 1440 | if (up) { |
1441 | if (!hmidi->istimer) { | 1441 | if (!hmidi->istimer) { |
1442 | setup_timer(&hmidi->timer, snd_hdsp_midi_output_timer, | 1442 | timer_setup(&hmidi->timer, snd_hdsp_midi_output_timer, |
1443 | (unsigned long) hmidi); | 1443 | 0); |
1444 | mod_timer(&hmidi->timer, 1 + jiffies); | 1444 | mod_timer(&hmidi->timer, 1 + jiffies); |
1445 | hmidi->istimer++; | 1445 | hmidi->istimer++; |
1446 | } | 1446 | } |
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index f20d42714e4d..4c59983158e0 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c | |||
@@ -1946,9 +1946,9 @@ snd_hdspm_midi_input_trigger(struct snd_rawmidi_substream *substream, int up) | |||
1946 | spin_unlock_irqrestore (&hdspm->lock, flags); | 1946 | spin_unlock_irqrestore (&hdspm->lock, flags); |
1947 | } | 1947 | } |
1948 | 1948 | ||
1949 | static void snd_hdspm_midi_output_timer(unsigned long data) | 1949 | static void snd_hdspm_midi_output_timer(struct timer_list *t) |
1950 | { | 1950 | { |
1951 | struct hdspm_midi *hmidi = (struct hdspm_midi *) data; | 1951 | struct hdspm_midi *hmidi = from_timer(hmidi, t, timer); |
1952 | unsigned long flags; | 1952 | unsigned long flags; |
1953 | 1953 | ||
1954 | snd_hdspm_midi_output_write(hmidi); | 1954 | snd_hdspm_midi_output_write(hmidi); |
@@ -1976,8 +1976,8 @@ snd_hdspm_midi_output_trigger(struct snd_rawmidi_substream *substream, int up) | |||
1976 | spin_lock_irqsave (&hmidi->lock, flags); | 1976 | spin_lock_irqsave (&hmidi->lock, flags); |
1977 | if (up) { | 1977 | if (up) { |
1978 | if (!hmidi->istimer) { | 1978 | if (!hmidi->istimer) { |
1979 | setup_timer(&hmidi->timer, snd_hdspm_midi_output_timer, | 1979 | timer_setup(&hmidi->timer, |
1980 | (unsigned long) hmidi); | 1980 | snd_hdspm_midi_output_timer, 0); |
1981 | mod_timer(&hmidi->timer, 1 + jiffies); | 1981 | mod_timer(&hmidi->timer, 1 + jiffies); |
1982 | hmidi->istimer++; | 1982 | hmidi->istimer++; |
1983 | } | 1983 | } |
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index a98647ac497c..735f2d0033dd 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c | |||
@@ -3340,9 +3340,9 @@ static irqreturn_t rt5645_irq(int irq, void *data) | |||
3340 | return IRQ_HANDLED; | 3340 | return IRQ_HANDLED; |
3341 | } | 3341 | } |
3342 | 3342 | ||
3343 | static void rt5645_btn_check_callback(unsigned long data) | 3343 | static void rt5645_btn_check_callback(struct timer_list *t) |
3344 | { | 3344 | { |
3345 | struct rt5645_priv *rt5645 = (struct rt5645_priv *)data; | 3345 | struct rt5645_priv *rt5645 = from_timer(rt5645, t, btn_check_timer); |
3346 | 3346 | ||
3347 | queue_delayed_work(system_power_efficient_wq, | 3347 | queue_delayed_work(system_power_efficient_wq, |
3348 | &rt5645->jack_detect_work, msecs_to_jiffies(5)); | 3348 | &rt5645->jack_detect_work, msecs_to_jiffies(5)); |
@@ -3934,8 +3934,7 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, | |||
3934 | regmap_update_bits(rt5645->regmap, RT5645_IRQ_CTRL2, | 3934 | regmap_update_bits(rt5645->regmap, RT5645_IRQ_CTRL2, |
3935 | RT5645_JD_1_1_MASK, RT5645_JD_1_1_INV); | 3935 | RT5645_JD_1_1_MASK, RT5645_JD_1_1_INV); |
3936 | } | 3936 | } |
3937 | setup_timer(&rt5645->btn_check_timer, | 3937 | timer_setup(&rt5645->btn_check_timer, rt5645_btn_check_callback, 0); |
3938 | rt5645_btn_check_callback, (unsigned long)rt5645); | ||
3939 | 3938 | ||
3940 | INIT_DELAYED_WORK(&rt5645->jack_detect_work, rt5645_jack_detect_work); | 3939 | INIT_DELAYED_WORK(&rt5645->jack_detect_work, rt5645_jack_detect_work); |
3941 | INIT_DELAYED_WORK(&rt5645->rcclock_work, rt5645_rcclock_work); | 3940 | INIT_DELAYED_WORK(&rt5645->rcclock_work, rt5645_rcclock_work); |
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c index 6c49f3d6fd96..d40219678700 100644 --- a/sound/soc/omap/ams-delta.c +++ b/sound/soc/omap/ams-delta.c | |||
@@ -260,7 +260,7 @@ static bool cx81801_cmd_pending; | |||
260 | static bool ams_delta_muted; | 260 | static bool ams_delta_muted; |
261 | static DEFINE_SPINLOCK(ams_delta_lock); | 261 | static DEFINE_SPINLOCK(ams_delta_lock); |
262 | 262 | ||
263 | static void cx81801_timeout(unsigned long data) | 263 | static void cx81801_timeout(struct timer_list *unused) |
264 | { | 264 | { |
265 | int muted; | 265 | int muted; |
266 | 266 | ||
@@ -349,7 +349,7 @@ static void cx81801_receive(struct tty_struct *tty, | |||
349 | /* First modem response, complete setup procedure */ | 349 | /* First modem response, complete setup procedure */ |
350 | 350 | ||
351 | /* Initialize timer used for config pulse generation */ | 351 | /* Initialize timer used for config pulse generation */ |
352 | setup_timer(&cx81801_timer, cx81801_timeout, 0); | 352 | timer_setup(&cx81801_timer, cx81801_timeout, 0); |
353 | 353 | ||
354 | v253_ops.receive_buf(tty, cp, fp, count); | 354 | v253_ops.receive_buf(tty, cp, fp, count); |
355 | 355 | ||